Skip to content

Commit 7c5798c

Browse files
authored
Instructions for building on macOS on Apple Silicon (#754)
1 parent d93760e commit 7c5798c

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

DEVELOPMENT.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ to pull down or update submodules.
1616

1717
### Building the JS Compute Runtime
1818

19-
To build from source, you need to have the following tools installed to successfully build, and build from a linux based system.
19+
To build from source, you need to have the following tools installed to successfully build, depending on your system.
20+
21+
#### Linux
2022

2123
- Rust
2224
```
@@ -58,6 +60,65 @@ Once that is done, the runtime and the CLI tool for applying it to JS source cod
5860
npm run build
5961
```
6062

63+
#### macOS (Apple silicon)
64+
65+
- Build tools
66+
```sh
67+
# First, install Xcode from the Mac App Store. Then:
68+
sudo xcode-select --switch /Applications/Xcode.app
69+
sudo xcodebuild -license
70+
```
71+
- Homebrew
72+
```sh
73+
# From homebrew.sh
74+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
75+
```
76+
- wget
77+
```sh
78+
brew install wget
79+
```
80+
- binaryen
81+
```sh
82+
brew install binaryen
83+
```
84+
- Python 3.11 (Spidermonkey build requires a version before 3.12)
85+
```sh
86+
brew install [email protected]
87+
```
88+
- Rust
89+
```sh
90+
curl -so rust.sh https://sh.rustup.rs && sh rust.sh -y
91+
# then, restart shell or run:
92+
source $HOME/.cargo/env
93+
```
94+
- rust target wasm32-wasi
95+
```sh
96+
rustup target add wasm32-wasi
97+
```
98+
- [cbindgen](https://github.com/eqrion/cbindgen#quick-start)
99+
```sh
100+
cargo install cbindgen
101+
```
102+
- [wasi-sdk, version 20](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-20),
103+
with alternate [install instructions](https://github.com/WebAssembly/wasi-sdk#install)
104+
```sh
105+
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz
106+
tar xf wasi-sdk-20.0-macos.tar.gz
107+
sudo mkdir -p /opt/wasi-sdk
108+
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
109+
```
110+
111+
Once you have those installed, you will need to compile SpiderMonkey:
112+
```sh
113+
export PATH="/opt/homebrew/opt/[email protected]/libexec/bin:$PATH"
114+
(cd runtime/spidermonkey && bash build-engine.sh)
115+
```
116+
117+
Once that is done, the runtime and the CLI tool for applying it to JS source code can be built using npm:
118+
```sh
119+
npm run build
120+
```
121+
61122
## Testing
62123

63124
The JS Compute Runtime has automated tests which run on all pull-requests. The test applications are located within <./integration-tests/js-compute>.

0 commit comments

Comments
 (0)