Packaging a 35Mb project on macOS produces a 3Gb app

I have seen different posts about packages size and how to reduce that but none really helped.

I have a pretty small project which is about 35Mb and whenever I package it for macOS, it produces a 3Gb app file.
Why is that happening? Any clue how to bring it down to a decent size?

It is silly because I see the same binary being copied over in different places within that app. You will see that BrickGame-Mac-Shipping is there twice and then there is an UnrealGame-Mac-Shipping which is there 4 times and I have no clue what that is!

➜  Mac tree -v --charset utf-8 -s -h
[ 128]  .
└── [  96]  BrickGame-Mac-Shipping.app
    └── [ 256]  Contents
        β”œβ”€β”€ [1.6K]  Info.plist
        β”œβ”€β”€ [  96]  MacOS
        β”‚   └── [394M]  BrickGame-Mac-Shipping
        β”œβ”€β”€ [   8]  PkgInfo
        β”œβ”€β”€ [ 160]  Resources
        β”‚   β”œβ”€β”€ [ 14K]  AppIcon.icns
        β”‚   β”œβ”€β”€ [507K]  Assets.car
        β”‚   └── [ 160]  LaunchScreen.storyboardc
        β”‚       β”œβ”€β”€ [1.5K]  01J-lp-oVM-view-Ze5-6b-2t3.nib
        β”‚       β”œβ”€β”€ [ 193]  Info.plist
        β”‚       └── [ 973]  LaunchScreen.nib
        β”œβ”€β”€ [ 192]  UE
        β”‚   β”œβ”€β”€ [  96]  BrickGame
        β”‚   β”‚   └── [ 160]  Content
        β”‚   β”‚       β”œβ”€β”€ [ 224]  Paks
        β”‚   β”‚       β”‚   β”œβ”€β”€ [8.7M]  BrickGame-Mac.pak
        β”‚   β”‚       β”‚   β”œβ”€β”€ [ 23M]  BrickGame-Mac.ucas
        β”‚   β”‚       β”‚   β”œβ”€β”€ [421K]  BrickGame-Mac.utoc
        β”‚   β”‚       β”‚   β”œβ”€β”€ [1.9M]  global.ucas
        β”‚   β”‚       β”‚   └── [ 575]  global.utoc
        β”‚   β”‚       β”œβ”€β”€ [ 18M]  brickgame_sf_metal_sm5-metal_sm5.0.metallib
        β”‚   β”‚       └── [ 43M]  global_sf_metal_sm5-metal_sm5.0.metallib
        β”‚   β”œβ”€β”€ [  96]  BrickGame-Mac-Shipping.app
        β”‚   β”‚   └── [ 256]  Contents
        β”‚   β”‚       β”œβ”€β”€ [1.6K]  Info.plist
        β”‚   β”‚       β”œβ”€β”€ [  96]  MacOS
        β”‚   β”‚       β”‚   └── [394M]  BrickGame-Mac-Shipping
        β”‚   β”‚       β”œβ”€β”€ [   8]  PkgInfo
        β”‚   β”‚       β”œβ”€β”€ [ 160]  Resources
        β”‚   β”‚       β”‚   β”œβ”€β”€ [ 14K]  AppIcon.icns
        β”‚   β”‚       β”‚   β”œβ”€β”€ [507K]  Assets.car
        β”‚   β”‚       β”‚   └── [ 160]  LaunchScreen.storyboardc
        β”‚   β”‚       β”‚       β”œβ”€β”€ [1.5K]  01J-lp-oVM-view-Ze5-6b-2t3.nib
        β”‚   β”‚       β”‚       β”œβ”€β”€ [ 193]  Info.plist
        β”‚   β”‚       β”‚       └── [ 973]  LaunchScreen.nib
        β”‚   β”‚       β”œβ”€β”€ [ 192]  UE
        β”‚   β”‚       β”‚   β”œβ”€β”€ [  96]  BrickGame
        β”‚   β”‚       β”‚   β”‚   └── [ 160]  Content
        β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ [ 224]  Paks
        β”‚   β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ [8.7M]  BrickGame-Mac.pak
        β”‚   β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ [ 23M]  BrickGame-Mac.ucas
        β”‚   β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ [421K]  BrickGame-Mac.utoc
        β”‚   β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ [1.9M]  global.ucas
        β”‚   β”‚       β”‚   β”‚       β”‚   └── [ 575]  global.utoc
        β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ [ 18M]  brickgame_sf_metal_sm5-metal_sm5.0.metallib
        β”‚   β”‚       β”‚   β”‚       └── [ 43M]  global_sf_metal_sm5-metal_sm5.0.metallib
        β”‚   β”‚       β”‚   β”œβ”€β”€ [  96]  BrickGame-Mac-Shipping.app
        β”‚   β”‚       β”‚   β”‚   └── [ 192]  Contents
        β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ [1.6K]  Info.plist
        β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ [  96]  MacOS
        β”‚   β”‚       β”‚   β”‚       β”‚   └── [392M]  BrickGame-Mac-Shipping
        β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ [   8]  PkgInfo
        β”‚   β”‚       β”‚   β”‚       └── [ 160]  Resources
        β”‚   β”‚       β”‚   β”‚           β”œβ”€β”€ [ 14K]  AppIcon.icns
        β”‚   β”‚       β”‚   β”‚           β”œβ”€β”€ [507K]  Assets.car
        β”‚   β”‚       β”‚   β”‚           └── [ 160]  LaunchScreen.storyboardc
        β”‚   β”‚       β”‚   β”‚               β”œβ”€β”€ [1.5K]  01J-lp-oVM-view-Ze5-6b-2t3.nib
        β”‚   β”‚       β”‚   β”‚               β”œβ”€β”€ [ 193]  Info.plist
        β”‚   β”‚       β”‚   β”‚               └── [ 973]  LaunchScreen.nib
        β”‚   β”‚       β”‚   β”œβ”€β”€ [  96]  Engine
        β”‚   β”‚       β”‚   β”‚   └── [ 128]  Binaries
        β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ [ 128]  Mac
        β”‚   β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ [392M]  UnrealGame-Mac-Shipping
        β”‚   β”‚       β”‚   β”‚       β”‚   └── [  96]  UnrealGame-Mac-Shipping.app
        β”‚   β”‚       β”‚   β”‚       β”‚       └── [ 192]  Contents
        β”‚   β”‚       β”‚   β”‚       β”‚           β”œβ”€β”€ [1.6K]  Info.plist
        β”‚   β”‚       β”‚   β”‚       β”‚           β”œβ”€β”€ [  96]  MacOS
        β”‚   β”‚       β”‚   β”‚       β”‚           β”‚   └── [394M]  UnrealGame-Mac-Shipping
        β”‚   β”‚       β”‚   β”‚       β”‚           β”œβ”€β”€ [   8]  PkgInfo
        β”‚   β”‚       β”‚   β”‚       β”‚           └── [  96]  _CodeSignature
        β”‚   β”‚       β”‚   β”‚       β”‚               └── [3.5K]  CodeResources
        β”‚   β”‚       β”‚   β”‚       └── [ 160]  ThirdParty
        β”‚   β”‚       β”‚   β”‚           β”œβ”€β”€ [  96]  Intel
        β”‚   β”‚       β”‚   β”‚           β”‚   └── [  96]  TBB
        β”‚   β”‚       β”‚   β”‚           β”‚       └── [ 128]  Mac
        β”‚   β”‚       β”‚   β”‚           β”‚           β”œβ”€β”€ [535K]  libtbb.dylib
        β”‚   β”‚       β”‚   β”‚           β”‚           └── [312K]  libtbbmalloc.dylib
        β”‚   β”‚       β”‚   β”‚           β”œβ”€β”€ [  96]  Ogg
        β”‚   β”‚       β”‚   β”‚           β”‚   └── [  96]  Mac
        β”‚   β”‚       β”‚   β”‚           β”‚       └── [157K]  libogg.dylib
        β”‚   β”‚       β”‚   β”‚           └── [  96]  Vorbis
        β”‚   β”‚       β”‚   β”‚               └── [  96]  Mac
        β”‚   β”‚       β”‚   β”‚                   └── [6.4M]  libvorbis.dylib
        β”‚   β”‚       β”‚   └── [  48]  UECommandLine.txt
        β”‚   β”‚       └── [  96]  _CodeSignature
        β”‚   β”‚           └── [7.9K]  CodeResources
        β”‚   β”œβ”€β”€ [  96]  Engine
        β”‚   β”‚   └── [ 128]  Binaries
        β”‚   β”‚       β”œβ”€β”€ [ 128]  Mac
        β”‚   β”‚       β”‚   β”œβ”€β”€ [392M]  UnrealGame-Mac-Shipping
        β”‚   β”‚       β”‚   └── [  96]  UnrealGame-Mac-Shipping.app
        β”‚   β”‚       β”‚       └── [ 192]  Contents
        β”‚   β”‚       β”‚           β”œβ”€β”€ [1.6K]  Info.plist
        β”‚   β”‚       β”‚           β”œβ”€β”€ [  96]  MacOS
        β”‚   β”‚       β”‚           β”‚   └── [394M]  UnrealGame-Mac-Shipping
        β”‚   β”‚       β”‚           β”œβ”€β”€ [   8]  PkgInfo
        β”‚   β”‚       β”‚           └── [  96]  _CodeSignature
        β”‚   β”‚       β”‚               └── [3.5K]  CodeResources
        β”‚   β”‚       └── [ 160]  ThirdParty
        β”‚   β”‚           β”œβ”€β”€ [  96]  Intel
        β”‚   β”‚           β”‚   └── [  96]  TBB
        β”‚   β”‚           β”‚       └── [ 128]  Mac
        β”‚   β”‚           β”‚           β”œβ”€β”€ [535K]  libtbb.dylib
        β”‚   β”‚           β”‚           └── [312K]  libtbbmalloc.dylib
        β”‚   β”‚           β”œβ”€β”€ [  96]  Ogg
        β”‚   β”‚           β”‚   └── [  96]  Mac
        β”‚   β”‚           β”‚       └── [157K]  libogg.dylib
        β”‚   β”‚           └── [  96]  Vorbis
        β”‚   β”‚               └── [  96]  Mac
        β”‚   β”‚                   └── [6.4M]  libvorbis.dylib
        β”‚   └── [  48]  UECommandLine.txt
        └── [  96]  _CodeSignature
            └── [ 13K]  CodeResources

56 directories, 60 files
1 Like

An update on this. I forgot to mention this was a Blueprint-only project. I added a C++ class to it and now it goes through modern Xcode project generation and it is building the whole executable as a single binary, apparently. What I understand is that for Bluepriont-only projects, it just takes some pre-compiled binary and copies into the generated application (and probably does something wrong as it appears four times).
Now the size is down to about 700Mb but the game’s executable is still there twice.
I don’t understand why there is a copy in Contents/UE/BrickGame/Binaries/Mac, that one seems totally superfluous, as long as the one in Contents/MacOS is used. And in the worst case it should just be a symlink. Anyone who has a clue why it is that way?

➜  Mac tree -v --charset utf-8 -s -h
[ 128]  .
└── [  96]  BrickGame.app
    └── [ 256]  Contents
        β”œβ”€β”€ [1.5K]  Info.plist
        β”œβ”€β”€ [  96]  MacOS
        β”‚   └── [293M]  BrickGame
        β”œβ”€β”€ [   8]  PkgInfo
        β”œβ”€β”€ [ 160]  Resources
        β”‚   β”œβ”€β”€ [ 14K]  AppIcon.icns
        β”‚   β”œβ”€β”€ [507K]  Assets.car
        β”‚   └── [ 160]  LaunchScreen.storyboardc
        β”‚       β”œβ”€β”€ [1.5K]  01J-lp-oVM-view-Ze5-6b-2t3.nib
        β”‚       β”œβ”€β”€ [ 193]  Info.plist
        β”‚       └── [ 973]  LaunchScreen.nib
        β”œβ”€β”€ [ 160]  UE
        β”‚   β”œβ”€β”€ [ 128]  BrickGame
        β”‚   β”‚   β”œβ”€β”€ [  96]  Binaries
        β”‚   β”‚   β”‚   └── [  96]  Mac
        β”‚   β”‚   β”‚       └── [293M]  BrickGame
        β”‚   β”‚   └── [ 160]  Content
        β”‚   β”‚       β”œβ”€β”€ [ 224]  Paks
        β”‚   β”‚       β”‚   β”œβ”€β”€ [8.9M]  BrickGame-Mac.pak
        β”‚   β”‚       β”‚   β”œβ”€β”€ [ 25M]  BrickGame-Mac.ucas
        β”‚   β”‚       β”‚   β”œβ”€β”€ [421K]  BrickGame-Mac.utoc
        β”‚   β”‚       β”‚   β”œβ”€β”€ [1.9M]  global.ucas
        β”‚   β”‚       β”‚   └── [ 575]  global.utoc
        β”‚   β”‚       β”œβ”€β”€ [ 18M]  brickgame_sf_metal_sm5-metal_sm5.0.metallib
        β”‚   β”‚       └── [ 43M]  global_sf_metal_sm5-metal_sm5.0.metallib
        β”‚   β”œβ”€β”€ [  96]  Engine
        β”‚   β”‚   └── [  96]  Binaries
        β”‚   β”‚       └── [ 160]  ThirdParty
        β”‚   β”‚           β”œβ”€β”€ [  96]  Intel
        β”‚   β”‚           β”‚   └── [  96]  TBB
        β”‚   β”‚           β”‚       └── [ 128]  Mac
        β”‚   β”‚           β”‚           β”œβ”€β”€ [535K]  libtbb.dylib
        β”‚   β”‚           β”‚           └── [312K]  libtbbmalloc.dylib
        β”‚   β”‚           β”œβ”€β”€ [  96]  Ogg
        β”‚   β”‚           β”‚   └── [  96]  Mac
        β”‚   β”‚           β”‚       └── [157K]  libogg.dylib
        β”‚   β”‚           └── [  96]  Vorbis
        β”‚   β”‚               └── [  96]  Mac
        β”‚   β”‚                   └── [6.4M]  libvorbis.dylib
        β”‚   └── [  48]  UECommandLine.txt
        └── [  96]  _CodeSignature
            └── [5.6K]  CodeResources

23 directories, 22 files
1 Like