2023-02-23 07:19:29 +03:00
# Roc installation guide for x86_64 MacOS systems
2022-08-27 08:51:57 +03:00
## How to install Roc
2022-09-07 08:24:24 +03:00
In order to develop in Roc, you need to install the Roc CLI,
2023-03-29 20:41:40 +03:00
which includes the Roc compiler and some helpful utilities.
2022-09-07 08:24:24 +03:00
2023-10-27 15:01:16 +03:00
1. Download the latest roc nightly using the terminal:
2022-08-27 08:51:57 +03:00
```sh
2023-10-27 15:01:16 +03:00
curl -OL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
2022-06-28 19:51:28 +03:00
```
2022-08-27 08:51:57 +03:00
1. Untar the archive:
```sh
2023-09-23 12:44:57 +03:00
tar xf roc_nightly-macos_x86_64-latest.tar.gz
2022-09-19 19:13:41 +03:00
cd roc_night< TAB TO AUTOCOMPLETE >
2022-06-28 19:51:28 +03:00
```
2022-08-27 08:51:57 +03:00
2023-11-24 18:09:08 +03:00
1. Install required dependencies:
```sh
brew install z3 zstd
```
2022-12-19 18:06:13 +03:00
1. To be able to run the `roc` command anywhere on your system; add the line below to your shell startup script (.profile, .zshrc, ...):
2023-09-23 12:44:57 +03:00
2022-12-19 18:06:13 +03:00
```sh
2022-12-19 18:13:10 +03:00
export PATH=$PATH:~/path/to/roc_nightly-macos_x86_64-< VERSION >
2022-12-19 18:06:13 +03:00
```
1. Check everything worked by executing `roc version`
2022-09-07 08:24:24 +03:00
## How to install Roc platform dependencies
2022-12-19 18:06:13 +03:00
This step is not necessary if you only want to use the [basic-cli platform ](https://github.com/roc-lang/basic-cli ), like in the tutorial.
But, if you want to compile Roc apps with other platforms (either in [`examples/` ](https://github.com/roc-lang/roc/tree/main/examples ) or in your own projects),
you'll need to install one or more of these platform languages too.
2022-08-27 08:51:57 +03:00
2022-09-07 08:15:00 +03:00
1. Install the Rust compiler, for apps with Rust-based platforms:
2022-08-27 08:51:57 +03:00
```sh
2022-06-28 19:51:28 +03:00
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
2022-08-27 08:51:57 +03:00
2023-09-25 04:32:19 +03:00
1. If you'd like to use Zig-based platforms: download [zig 0.11.0 ](https://ziglang.org/download/0.11.0/zig-macos-x86_64-0.11.0.tar.xz ), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.11.0 is not available on homebrew.
2022-08-27 08:51:57 +03:00
1. Run examples:
```sh
# Note: If you installed rust in this terminal session, you'll need to open a new one first!
2022-10-17 16:22:20 +03:00
./roc examples/platform-switching/rocLovesRust.roc
2022-08-27 08:51:57 +03:00
2022-10-17 16:22:20 +03:00
./roc examples/platform-switching/rocLovesZig.roc
2022-08-27 08:51:57 +03:00
2022-10-17 16:22:20 +03:00
./roc examples/platform-switching/rocLovesC.roc
2022-06-28 19:51:28 +03:00
```
2024-03-23 14:42:06 +03:00
## Next Steps
- [editor setup ](https://www.roc-lang.org/install#editor-extensions )
- [tutorial ](https://www.roc-lang.org/tutorial )
- [examples ](https://www.roc-lang.org/examples )