Giter Site home page Giter Site logo

joplin-arm64-darwin-guide's Introduction

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

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

I successfully compiled with these versions:

Node: v16.13.1

Npm: 8.1.2

Yarn: 3.1.1

2) Prepare Files

Clone Joplin repo

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

Modify Joplin .json files

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

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/[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

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

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.

Conclusion

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.

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.

joplin-arm64-darwin-guide's People

Contributors

noah-nash avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.