前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >使用homebrew管理linux和mac的包

使用homebrew管理linux和mac的包

原创
作者头像
生信探索
发布2023-04-07 09:02:44
发布2023-04-07 09:02:44
1.1K0
举报
文章被收录于专栏:生信探索生信探索

添加镜像

linux和apple都一样,先添加变量

代码语言:shell
复制
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"

export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"

Apple M2

  • 安装CLT for Xcode
代码语言:shell
复制
xcode-select --install
  • 安装brew
代码语言:shell
复制
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
  • 加入环境变量
代码语言:shell
复制
test -r ~/.bash_profile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
test -r ~/.zprofile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

Ubuntu 22.4

需要git 和 curl

无root

  • 安装到~/homebrew
代码语言:shell
复制
cd ~
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
  • 加入环境变量
代码语言:shell
复制
mkdir -p ~/APP/bin
export PATH=$HOME/APP/bin:$PATH
ln -s $HOME/homebrew/bin/brew $HOME/APP/bin/brew

有root

  • 安装
代码语言:shell
复制
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
  • 加入环境变量
代码语言:shell
复制
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

更新

代码语言:shell
复制
brew update

Uninstall

-p是homebrew的安装路径,root安装的homebrew有默认路径,不需要卸载的时候指定这个参数

代码语言:shell
复制
cd ~
wget https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh
bash uninstall.sh -p ~/homebrew

安装mamba

  • linux

linux上只能安装micromamba

代码语言:shell
复制
brew install micromamba
# 手动安装mamba
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
bash Mambaforge-Linux-x86_64.sh
  • Apple M2
代码语言:shell
复制
brew install --cask mambaforge
# 单细胞分析环境
mamba create -n SC && mamba activate SC
mamba install -y -c conda-forge python=3.10 notebook ipywidgets pandas numpy seaborn matplotlib ipykernel openpyxl pyarrow scanpy python-igraph leidenalg pytables jaxlib leidenalg

Reference

代码语言:text
复制
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
https://docs.brew.sh/Installation#alternative-installs

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Apple M2
  • Ubuntu 22.4
    • 无root
    • 有root
  • 更新
  • Uninstall
  • 安装mamba
  • Reference
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档