LoginSignup
1
1

More than 1 year has passed since last update.

Zig言語をUbuntu(WSL2)にインストール

Posted at

WSL2ではSnapdが使えないため、代わりにリリースページのビルド済みバイナリを用いてインストールする。

# ビルド済みバイナリをダウンロード(URLは適宜置き換え)
$ wget https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.3051+b8bf5de75.tar.xz

# インストールディレクトリを作成
$ sudo mkdir /usr/local/zig

# インストールディレクトリに解凍(ファイル名は適宜置き換え)
sudo tar Jxvf zig-linux-x86_64-0.10.0-dev.3051+b8bf5de75.tar.xz -C /usr/local/zig --strip-components 1

特に問題がなければ/usr/local/zigにZigの実行ファイル等が配置されるはずである。
忘れずにパスも通しておこう。

~/.bash_profile
export PATH=/usr/local/zig:$PATH

追記できたら、~/.bash_profileを再度読み込んでzig versionを実行してみよう。

$ source ~/.bash_profile
$ zig version
0.10.0-dev.3051+b8bf5de75

バージョンが表示されていればインストール成功である。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1