要在Ubuntu上自定义安装路径,可以按照以下步骤操作:
首先,下载Homebrew的安装脚本并运行:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"然后,编辑Homebrew的配置文件~/.bashrc或~/.zshrc,添加以下内容:export PATH="/path/to/custom/installation/dir/bin:$PATH"export HOMEBREW_PREFIX="/path/to/custom/installation/dir"export HOMEBREW_CELLAR="/path/to/custom/installation/dir/Cellar"export HOMEBREW_REPOSITORY="/path/to/custom/installation/dir"将/path/to/custom/installation/dir替换为你希望安装Homebrew的自定义路径。
source ~/.bashrc最后,重新安装Homebrew到自定义路径:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"这样,Homebrew就会被安装到你指定的自定义路径中。


