ubuntu搭建swift开发环境
- 安装homebrew:https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
- 通过homebrew安装swift
安装homebrew
新建setup_homebrew_env.sh
#!/bin/bash
export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
新建install_homebrew.sh
#!/bin/bash
# 从本镜像下载安装脚本并安装 Homebrew / Linuxbrew
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.bash_profile
test -r ~/.profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.profile
test -r ~/.zprofile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.zprofile
# ==> Next steps:
# - Run these two commands in your terminal to add Homebrew to your PATH:
(
echo
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"'
) >>/home/sada/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# - Run these commands in your terminal to add the non-default Git remotes for Homebrew/brew and Homebrew/homebrew-core:
echo '# Set PATH, MANPATH, etc., for Homebrew.' >>/home/sada/.bashrc
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >>/home/sada/.bashrc
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >>/home/sada/.bashrc
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
# - Install Homebrew's dependencies if you have sudo access:
sudo apt-get install build-essential
# For more information, see:
# https://docs.brew.sh/Homebrew-on-Linux
# - We recommend that you install GCC:
# brew install gcc
# - Run brew help to get started
# - Further documentation:
# https://docs.brew.sh
进行安装
# 加载环境变量至当前终端,建议提前设置魔法
source setup_homebrew_env.sh
# 运行安装脚本
bahs install_homebrew.sh
参考资料
标签:git,edu,https,ubuntu,brew,homebrew,tuna,swift,搭建 From: https://www.cnblogs.com/Biiigwang/p/18058181/ubuntu-builds-the-swift-development-environme