Skip to content

noah-nash/joplin-arm64-darwin-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

joplin-arm64-darwin-guide

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 Ventura. In order to compile successfully it is required be running the same CPU architecture.

Update 2023: With the August release of Joplin, the application now supports Apple Silicon natively! To download the official arm64 release of Joplin, visit their Github page. Unless requested, I will no longer be updating the build instructions from here on out. The following guide is provided as-is.

1) Install Homebrew and dependencies

Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Joplin Dependencies

brew install cocoapods
brew install python
brew install vips
xcode-select install

Ensure node / npm / yarn is up to date

node -v, npm -v, yarn -v

As of writing, I successfully compiled with these versions:

Node: v18.17.1

Npm: 9.8.1

Yarn: 3.6.3

2) Prepare Files

Clone Joplin repo

git clone https://github.com/laurent22/joplin.git 
cd joplin

Change target architecture

In addition, you will have to change the build flag's target arch from x64 to arm64 in app-desktop/package.json. See: this PR for what to change No longer required.

Install npm packages

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/keytar-temp@7.4.99 ## Alt keytar if above does not work
# npm install sqlite3@4.1.0 —build-from-source ## Might not be necessary, run if build fails in step 3

Set npm config flags

# 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

3) Running Joplin

Build Joplin

yarn install
cd packages/app-desktop
yarn start 
# if it runs successfully, time to package
yarn run dist --publish=never --mac --arm64

Optional: you may also run yarn test to run Joplin's built-in unit tests to check stability.

Delete old install

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

Install new dmg

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”.

Updating Joplin

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.

If using the End-to-End encryption feature, you may be prompted about Joplin storing it's master password securely in your Mac's keychain. If so, click always allow.

Conclusion

Having used this for over a year, I have yet run into any problems so far, but keep in mind that no guarantees are given. Since this is not actively supported by the official project, don’t pester Joplin’s maintainers with any errors encountered in the process. If you do notice anything wrong, feel free to create an issue on this repo, and I can try and help. As of August 2023, Jopin now supports Apple Silicon natively!

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. Update 2023: To download the official Apple Silicon release of Joplin, visit their Github.

Troubleshooting

  • 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 run npm 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.