Install Rust on FreeBSD
| Update pkg | |
| Install lang rust | |
| rustc --version check | |
| Ports alternative |
Update pkg
Refresh the pkg catalog first so FreeBSD installs the current Rust package set.
A fresh catalog avoids version conflicts and keeps dependencies consistent on server and desktop systems.
sudo pkg update
Package catalog is up to date
Install lang rust
Install the lang/rust package for the compiler plus cargo for project management.
The package is large because it ships the compiler, the standard library, and supporting tools in one unit.
sudo pkg install lang/rust
Rust toolchain installed successfully
Accept the dependency prompt and let pkg finish before you test the version command.
rustc --version check
Ask the compiler for its version in a new shell to confirm the install.
rustc --version
rustc 1.75.0 (ad2397f6f 2023-12-28) (x86_64-unknown-freebsd)
A version reply means the compiler and cargo are on the PATH and ready to use.
Ports alternative
The Ports tree offers an alternative when you need custom build options or a newer snapshot than pkg provides.
Look for the lang/rust entry in the Ports collection and build it with the standard Ports workflow. Most beginners should stay with pkg and only try Ports after the basics feel comfortable.
Next: Rust in Docker
Article author: Arthur Isaev