Instructions to build Joplin on M1 Apple Silicon.
This is a mirror of the post found on my website at https://noahnash.net/blog/joplin-apple-silicon
Note: I only update this github repo periodically, my website will contain the most up to date guide.
Keep in mind this has only been tested with a M1 Mac running Big Sur. In order to compile successfully it is required be running the same CPU architecture.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install cocoapods
brew install python
brew install vips
xcode-select install
node -v
, npm -v
, yarn -v
I successfully compiled with these versions:
Node: v16.13.1
Npm: 8.1.2
Yarn: 3.1.1
git clone https://github.com/laurent22/joplin.git
cd joplin
You will need to update some dependency versions to those that are M1 native. (don't worry it's easy). See: this PR for a list of files.
In addition, you will have to change the target arch from x64 to arm64 in app-desktop/package.json. See: this PR for what to change
npm install sharp
# For some reason npm will throw errors if keytar not built beforehand
npm install Keytar —build-from-source
# npm install -g @dennisameling/[email protected] ## Alt keytar if above does not work
# npm install [email protected] —build-from-source ## Might not be necessary, run if build fails in step 3
# Enable codepack for Node/Yarn
corepack enable
export npm_config_arch=arm64
export npm_target_arch=arm64
export sdkroot=macosx
# sqlite3 errors if not set beforehand
npm config set python python3
yarn install
cd packages/app-desktop
yarn start
# if it runs successfully, time to package
yarn run dist --publish=never --mac --arm64
There will be conflicts if you don't delete the old x64 install of Joplin.
In order to uninstall it, move the previous joplin.app to the trash. Then delete the data folder.
# Delete Joplin data folder: make sure you backup everything you need beforehand
rm -r ~/.config/joplin-desktop
A .dmg file should be in joplin/packages/app-desktop/dist
as generated by yarn run dist
command. Extract it and run it as you would the normal x64 binary.
Open activity monitor to verify that it is using the right CPU architecture. If all goes well, you should see Joplin’s CPU type being “Apple” instead of “Intel”.
When the Joplin app notifies you of an update, you will have to repeat the above process. Run git pull origin
to fetch the latest changes, then rebuild using yarn.
I haven’t tested it extensively, but I haven’t run into any problems as of yet. But since this is not actively supported by the official project, don’t pester Joplin’s maintainers with errors in the process. If you do notice anything wrong, feel free to create an issue on this repo, and I can try and help.
Note: due to Apple’s strict notarization and code-signing, shared prebuilt binaries will fail to boot unless you compile them yourself.
For reference I will provide my unsigned binary on this repo for troubleshooting reasons, but don't expect it to work out of the box.
- Make sure your NodeJS arch is arm64:
node -p "process.arch"
. - Be sure to read through npm error logs from start to finish.
- Macs sometimes have a bug that cause it to throw enotempty errors. A possible fix is running:
ulimit -Sn 4096
. - Between failed attempts: Try deleting all node_modules folders.
rm -rf node_modules
, and then runnpm i --package-lock-only
to update packages. - Run
npm audit fix
,npm run clean
, and other commands listed in the Joplin troubleshooting repo.
If that fails, feel free to contact me if you need any help, and I'll try to respond as soon as possible.