Install Rust on FreeBSD 13

In this guide, we will go through how to install Rust on FreeBSD 13. Rust is a general-purpose programming language focusing on performance, type safety, and concurrency. It enforces memory safety, which means that all references point to valid memory without using a garbage collector or reference counting, both of which are required in other memory-safe languages.

How to Install Rust on FreeBSD 13

  • Change to the superuser.
su -
  • Install curl using the command below.
pkg install curl 
  • Next, install Rust on FreeBSD using the following command.
pkg install rust

Sample output

Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    rust: 1.61.0

Number of packages to be installed: 1

The process will require 576 MiB more space.
111 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching rust-1.61.0.pkg: 100%  111 MiB 249.0kB/s    07:48    
Checking integrity... done (0 conflicting)
[1/1] Installing rust-1.61.0...
[1/1] Extracting rust-1.61.0: 100%
  • Confirm the Rust version installed using the following command.
rustc --version

Sample Rust Application on FreeBSD

  • Create a directory for your code files.
mkdir myproject
  • Change to the created directory.
cd myproject
  • Then create the sample application.
nano helloguys.rs

Copy and paste the code below. Save(ctrl+s) and close(ctrl+x) the file.

fn main() {
    println!("Hello from itnixpro.com!");
}
  • Compile the application above using the following command.
rustc helloguys.rs
  • Next, run the application using the command below.
./helloguys
  • You can also check if the installation works by creating Hello world using the cargo command.
cargo new check-install
cd check-install
cargo run

Sample output

Compiling check-install v0.1.0 (/usr/home/itnixpro/myproject/check-install)
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/check-install`
Hello, world!
  • That concludes our guide on how to install Rust on FreeBSD 13.

Read more about Rust

Other Tutorials

Monitor HAProxy Logs with ELK Stack

Install Xrdp on Rocky Linux 9

Install TeamViewer on Rocky Linux 9

System administrator | Software Developer | DevOps

Leave a Comment