Skip to content

Instantly share code, notes, and snippets.

@frozenpandaman
Last active August 15, 2024 17:34
Show Gist options
  • Save frozenpandaman/92a84cd2ba690bb2399afd04e695bf8c to your computer and use it in GitHub Desktop.
Save frozenpandaman/92a84cd2ba690bb2399afd04e695bf8c to your computer and use it in GitHub Desktop.
Installing a modern version of Aegisub on M1 Macs (Apple Silicon)

Update, March 2022: As of macOS 12.3, Aegisub r9198 and v3.3.2 (wangqr fork) no longer crash on launch.


Download a pre-built binary

ver. 9018-rcombs-local-6a556aac6: https://elifessler.com/aegi/6a556aa-Aegisub.app.zip (129.6 MB, built 2021-12-23)

Or, build it yourself

These are instructions for the fish shell. Some commands (e.g. export, set) might be different if you're using bash or zsh instead (e.g. CPPFLAGS= instead of set CPPFLAGS)

1. Clone the repo

git clone https://github.com/rcombs/Aegisub
cd Aegisub/
git checkout rcombs-local

2. Install dependencies & setup

brew install autoconf automake ffmpeg ffms2 fftw freetype fribidi gettext icu4c libass m4 pkg-config boost
brew install luajit --HEAD
brew link --force gettext
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig"
./autogen.sh

3. Build wxWidgets

cd vendor/wxWidgets/
set CPPFLAGS "$CPPFLAGS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -I/opt/homebrew/opt/boost/include"
git submodule update --init
./configure --disable-all-features --enable-unicode --enable-utf8 --enable-stl --enable-exceptions --enable-log --enable-threads --enable-palette --enable-baseevtloop --enable-selectloop --enable-gui --enable-timer --enable-menus --enable-intl --enable-xlocale --enable-statusbar --enable-sysoptions --enable-button --enable-bmpbutton --enable-listbook --enable-listbox --enable-listctrl --enable-checkbox --enable-textctrl --enable-hyperlink --enable-treebook --enable-image --enable-stopwatch --enable-scrollbar --enable-longlong --enable-geometry --enable-imaglist --enable-stc --enable-hotkey --enable-regkey --enable-graphics_ctx --enable-dataobj --enable-file --enable-ffile --enable-streams --enable-dragimage --enable-dnd --enable-radiobox --enable-radiobtn --enable-spinbtn --enable-spinctrl --enable-slider --enable-searchctrl --enable-stattext --enable-statline --enable-statbox --enable-statbmp --enable-toolbar --enable-tbarnative --enable-clipboard --enable-menubar --enable-msgdlg --enable-filedlg --enable-fontdlg --enable-textdlg --enable-choicedlg --enable-coldlg --enable-dirdlg --enable-numberdlg --enable-aboutdlg --enable-dataviewctrl --enable-datepick --enable-dirpicker --enable-filectrl --enable-filepicker --enable-fontpicker --enable-treectrl --enable-comboctrl --enable-rearrangectrl --enable-treelist --enable-timepick --enable-accel --enable-headerctrl --enable-variant --enable-datetime --enable-checklst --enable-choice --enable-choicebook --enable-combobox --enable-gauge --enable-tooltips --enable-validators --enable-std_string --enable-std-containers --enable-popupwin --enable-controls --enable-stc --enable-calendar --enable-sash --enable-splitter --enable-arcstream --enable-zipstream --enable-xpm --enable-dynlib --enable-dynamicloader --enable-fontenum --with-zlib --with-expat --with-libpng --with-cocoa --with-macosx-version-min=no --with-opengl --without-libjpeg --without-libtiff --without-regex
make -j10

4. Configure Aegisub

cd ../../
autoreconf -ivf
autoupdate
./configure --with-wxdir="$PWD/vendor/wxWidgets" --with-boost-libdir="/opt/homebrew/opt/boost/lib"

4. Janky fix for error

Edit libaegisub/common/charset.cpp Change #include <uchardet/uchardet.h> to #include <uchardet.h>

5. Build Aegisub

make
make osx-bundle
cd Aegisub.app/Contents/MacOS/
ln -s libicudata.69.1.dylib libicudata.69.dylib
ln -s libbrotlicommon.1.0.9.dylib libbrotlicommon.1.dylib
ln -s libicuuc.69.1.dylib libicuuc.69.dylib
cp /opt/homebrew/opt/boost/lib/libboost_system-mt.dylib libboost_system-mt.dylib
cd ../../../
codesign --force --deep --sign - Aegisub.app
@AuroraWright
Copy link

AuroraWright commented Dec 24, 2021

This mostly worked for me, thanks. A few notes:

  • I had to further add -I/opt/homebrew/opt/portaudio/include to CPPFLAGS otherwise it fails during the Aegisub build
  • I changed --with-boost-libdir="/opt/homebrew/opt/boost/lib" to --with-boost="/opt/homebrew/opt/boost" or it wouldn't work, it seems this has also been changed in the readme in rcombs' fork.
  • If you copy the aegisub binary from the src folder to the .app as you showed, it will depend on libraries built in the build folder (there are absolute paths to them in the executable). You can actually fix the .app manually like this for the moment (instead of the rm/cp steps):
cd Aegisub.app/Contents/MacOS
ln -s libicudata.69.1.dylib libicudata.69.dylib
ln -s libbrotlicommon.1.0.9.dylib libbrotlicommon.1.dylib
ln -s libicuuc.69.1.dylib libicuuc.69.dylib

I now have a working .app which doesn't depend on my build folder anymore, and probably works on any M1 machine, at least running Monterey (I think brew libraries are tied to the running OS). I uploaded it here https://transfer.sh/qinOf2/Aegisub.app.7z if anyone needs it

@frozenpandaman
Copy link
Author

frozenpandaman commented Dec 24, 2021

@AuroraWright Thanks a lot! I'll look into modifying the instructions per your notes when I next need to build it myself – I'm guessing there's just some system-to-system idiosyncrasies/differences with this all too.

Very helpful to note about the symlinks, that's definitely a better way of doing it (and confirmed, your linked build works on my machine)! I also had to do a ln -s libboost_system.dylib libboost_system-mt.dylib to get it to work for me when performing these steps myself.

@AuroraWright
Copy link

@frozenpandaman I'm glad it worked! About the libboost_system it's not in my command line history and the -mt dylib seems to be different from the other one so maybe I copied it from the brew folder to the .app with Finder and forgot, I did all of this earlier today and was going off my zsh history so it's possible haha.
So maybe this could be added cp /opt/homebrew/opt/boost/lib/libboost_system-mt.dylib libboost_system-mt.dylib

@frozenpandaman
Copy link
Author

@AuroraWright Ah, that's where the file is (makes sense). Thanks! I updated the instructions in the gist. And then if people don't want to go through all that themselves, they can just download the pre-built binary you posted. I'll mirror it to my site (since transfer.sh seems to only host files for 14 days) and link it above too.

@frozenpandaman
Copy link
Author

FYI: wangqr/Aegisub#117 (comment)

cc @AuroraWright in case you're interested. I wonder what changed to make these builds work on macOS 12.3.

@Pavel00x
Copy link

Pavel00x commented Jan 8, 2024

Hello, great for Apple Silicon Mac, thank you.
But - no UI language please?
In ver. 9018-rcombs-local-6a556aac6

Only-EN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment