roc/getting_started/macos_x86_64.md
2022-12-05 14:53:18 +01:00

2.1 KiB

Roc installation guide for x86_64 macOS systems

How to install Roc

⚠️ We do not yet officially support MacOS 13. But, as long as you are not using a zig or wasm platform most things should work fine.

⚠️ Macos x86_64 nightly releases lag behind the others due to unresolved test failures. The dbg keyword is not yet supported, as well as importing platforms using URLs. For the platform you can use the path instead, like in this example.

In order to develop in Roc, you need to install the Roc CLI, which includes the Roc compiler and various helpful utilities.

  1. Download the latest nightly from the assets here.

  2. To prevent "roc can't be opened because Apple can't check it...":

    xattr -d com.apple.quarantine roc_nightly-macos_x86_64-<VERSION>.tar.gz
    
  3. Untar the archive:

    mkdir roc_nightly-macos_x86_64-<VERSION>
    tar xf roc_nightly-macos_x86_64-<VERSION>.tar.gz --directory roc_nightly-macos_x86_64-<VERSION>
    cd roc_night<TAB TO AUTOCOMPLETE>
    

How to install Roc platform dependencies

In order to compile Roc apps (either in examples/ or in your own projects), you need to install one or more of these platform language compilers, too.

  1. Install the Rust compiler, for apps with Rust-based platforms:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  2. If you'd like to use Zig-based platforms: download zig 0.9.1, extract the archive and add export PATH=$PATH:~/path/to/zig to your shell startup script (.profile, .zshrc, …). Note: zig 0.9.1 is not available on homebrew.

  3. Run examples:

    # Note: If you installed rust in this terminal session, you'll need to open a new one first!
    ./roc examples/platform-switching/rocLovesRust.roc
    
    ./roc examples/platform-switching/rocLovesZig.roc
    
    ./roc examples/platform-switching/rocLovesC.roc