Debian/Ubuntu
curl https://dist.crystal-lang.org/apt/setup.sh | sudo bash
apt-key adv --keyserver keys.gnupg.net --recv-keys 09617FD37CC06B54
echo "deb https://dist.crystal-lang.org/apt crystal main" > /etc/apt/sources.list.d/crystal.list
apt-get update
sudo apt-get install crystal
# 更新
sudo apt-get update
sudo apt-get install crystal
Redhat/Centos
curl https://dist.crystal-lang.org/rpm/setup.sh | sudo bash
rpm --import https://dist.crystal-lang.org/rpm/RPM-GPG-KEY
cat > /etc/yum.repos.d/crystal.repo <<END
[crystal]
name = Crystal
baseurl = https://dist.crystal-lang.org/rpm/
END
sudo yum install crystal
#更新
sudo yum update crystal
Arch
sudo pacman -S crystal
Gentoo
# equery u dev-lang/crystal
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for dev-lang/crystal-0.18.7:
U I
- - doc : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
- - examples : Install examples, usually source code
+ + xml : Use the dev-libs/libxml2 library to enable Crystal xml module
+ - yaml : Use the dev-libs/libyaml library to enable Crystal yaml module
su -
emerge -a dev-lang/crystal
Mac-Osx
brew update
brew install crystal-lang
Linuxbrew
brew update
brew install crystal-lang
Ubuntu bash - windows
需要win10自带的Ubuntu环境, 安装方法同Ubuntu安装一样。
预编译文件安装
到此处 下载已编译好的二进制,把它放到环境变量的目录下就可以直接在命令行中运行。
源码安装
git clone https://github.com/crystal-lang/crystal.git
# 运行 make命令创建自己的crystal编译器
# 运行 make spec命令测试新的版本是否存在错误
# 使用 bin/crystal
# 事实上 ,编译生成的crystal是 .build/crystal
当前内容版权归 crystal-lang中文站 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 crystal-lang中文站 .