インストール

On elementary OS

In elementary OS, you can use the Official Crystal deb repository. SnapcraftLinuxbrew も使えます。

Crystal 公式の deb リポジトリ

To install latest stable Crystal release from the official Crystal repository hosted on the Open Build Service run in your command line:

curl -fsSL https://crystal-lang.org/install.sh | sudo bash

インストールスクリプトはその他のチャンネルのリリースをインストール、もしくは更新するためのオプション引数を受け付けます。

  • --version with major.minor or latest value
  • --channel 引数では、stableunstable、もしくはnightly の値を指定できます、
curl -fsSL https://crystal-lang.org/install.sh | sudo bash -s -- --channel=nightly

より詳細な情報はこの告知記事を参照してください。

マニュアルセットアップ

ディストリビューション名とリリース名を次のスクリプトの {REPOSITORY} に挿入することで、設定できます。 You can find available options on the installation page at OBS.

echo "deb http://download.opensuse.org/repositories/devel:/languages:/crystal/{REPOSITORY}/ /" | sudo tee /etc/apt/sources.list.d/crystal.list

# 署名用の鍵の追加
curl -fsSL https://download.opensuse.org/repositories/devel:languages:crystal/{REPOSITORY}/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/crystal.gpg > /dev/null

リポジトリの設定が完了すれば、Crystal がインストールできます。

sudo apt update
sudo apt install crystal

次のパッケージは必ずしも必要なわけではありません。ですが、標準ライブラリの対応する機能を利用するのであればインストールを推奨します。

sudo apt install libssl-dev      # for using OpenSSL
sudo apt install libxml2-dev     # for using XML
sudo apt install libyaml-dev     # for using YAML
sudo apt install libgmp-dev      # for using Big numbers
sudo apt install libz-dev        # for using crystal play

新しいバージョンの Crystal がリリースされた場合には、以下でアップグレードすることが可能です。

sudo apt update
sudo apt install crystal

Snapcraft を使う

Crystal の snap は classic な制限環境下を要求します。snapd がインストールしてあれば、Crystal をインストールする準備は万端です。

sudo snap install crystal --classic

最新のバージョンを edge チャンネルを使ってインストールすることもできます。

sudo snap install crystal --classic --edge

より詳しい情報は Crystal の snapcraft のページを参照してください。

Linuxbrew を使う

If you have Linuxbrew installed you’re ready to install Crystal:

brew update
brew install crystal-lang

言語にコントリビュートするつもりであれば、同時に LLVM もインストールしておくとよいでしょう。その場合、最後の行を以下の通りに変更してください。

brew install crystal-lang --with-llvm

インストールできましたか?

学ぶ

何か問題が発生しましたか?

フォーラムでのサポート