Mac: Run from Source Not Working - "We encountered a problem with your local email database."

Hi all! Love this project, but I am unable to run from source using the exact instructions on the README.

I am on an M2 Macbook Pro, and did a completely clean install as follows:

export npm_config_arch=x64 # If you are on an M1 / Apple Silicon Mac
npm install
npm start

I get the following error popup:

We encountered a problem with your local email database. We will now attempt to rebuild it.

Error: dlopen(/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node, 0x0001): tried: '/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (no such file), '/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

Here is my complete terminal output:

scott@aiur mailspring % npm start

> mailspring-root@0.0.1 start
> electron ./app --enable-logging --dev

2024-02-21 15:26:58.858 Electron[10519:105405] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
Running database migrations
App load time: 3292ms

{"error":null}
Error Downloading Update: Could not get code signature for running application
Error Downloading Update: Could not get code signature for running application
Error: dlopen(/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node, 0x0001): tried: '/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (no such file), '/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1869)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1226:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:1869)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at bindings (/Users/scott/dev/spellbook/mailspring/app/node_modules/bindings/bindings.js:112:48)
    at new Database (/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/lib/database.js:48:64)
    at openDatabase (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/stores/database-store.ts:53:16)
    at DatabaseStore.open (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/stores/database-store.ts:149:22)
    at new DatabaseStore (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/stores/database-store.ts:144:12)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/stores/database-store.ts:532:16)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/stores/database-store.ts:532:36)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.value [as .ts] (/Users/scott/dev/spellbook/mailspring/app/src/compile-cache.js:145:21)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/models/query-subscription.ts:1:1)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/models/query-subscription.ts:330:2)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.value [as .ts] (/Users/scott/dev/spellbook/mailspring/app/src/compile-cache.js:145:21)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/models/query-subscription-pool.ts:2:1)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/flux/models/query-subscription-pool.ts:119:21)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.value [as .ts] (/Users/scott/dev/spellbook/mailspring/app/src/compile-cache.js:145:21)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/global/mailspring-observables.ts:4:1)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/global/mailspring-observables.ts:171:3)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.value [as .ts] (/Users/scott/dev/spellbook/mailspring/app/src/compile-cache.js:145:21)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at new AppEnvConstructor (file:///Users/scott/dev/spellbook/mailspring/app/src/app-env.ts:116:5)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/secondary-window-bootstrap.ts:30:17)
    at Object.<anonymous> (file:///Users/scott/dev/spellbook/mailspring/app/src/secondary-window-bootstrap.ts:38:49)
    at Module._compile (node:internal/modules/cjs/loader:1141:14)
    at Object.value [as .ts] (/Users/scott/dev/spellbook/mailspring/app/src/compile-cache.js:145:21)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13377)
    at Function.o._load (node:electron/js2c/renderer_init:2:3109)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at setupWindow (file:///Users/scott/dev/spellbook/mailspring/app/static/index.js:48:3)
    at window.onload (file:///Users/scott/dev/spellbook/mailspring/app/static/index.js:69:5) {
  code: 'ERR_DLOPEN_FAILED'
} {}
[10519:0221/152701.102763:INFO:CONSOLE(99)] "Error: dlopen(/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node, 0x0001): tried: '/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (no such file), '/Users/scott/dev/spellbook/mailspring/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) [object Object]", source: /Users/scott/dev/spellbook/mailspring/app/src/error-logger.js (99)

Does anyone have any suggestions on how I can get up-and-running from source?

2 Likes

I got this same “incompatible architecture” error when updating to the latest version today. I’m on an old intel mac. I’m going to try to run it from source.

Running from source worked for me with envar npm_config_arch set to x64 via: export npm_config_arch=x64 on an intel mac. Which makes me think the documentation is wrong and that “x64” may be the value for intel and not for Apple Silicon like the comment in the command would suggest. I don’t have and M1 (or any other Apple Silicon) to test with, but if I did I would try setting npm_config_arch to something like x86_64 or arm64.

Good luck.

Just go to GitHub and download version 14 until 15 is fixed: Release 1.14.0 · Foundry376/Mailspring · GitHub

(post deleted by author)