Open cndaqiang opened 5 years ago
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
添加PATH
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
PATH=/usr/local/bin:$PATH
之后安装的程序都在/usr/local/bin
里,包括各版本的python等
~/soft/gcc $ brew search gcc
==> Formulae
gcc gcc@5 gcc@7 i386-elf-gcc
gcc@4.9 ✔ gcc@6 gcc@8
~/soft/gcc $
brew install gcc@4.9
安装之后
~/soft/gcc $ gcc
gcc gcc-ar-4.9 gcc-ranlib-4.9
gcc-4.9 gcc-nm-4.9
~/soft/gcc $ gcc-4.9 --version
gcc-4.9 (Homebrew GCC 4.9.4_1) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
需要建立索引,把系统默认的gcc提成gcc-4.9
gcc默认也安装了gfortran,👍
关于gcc的更多设置,见mac配置开发环境
~ $ brew info ruby@2.4
ruby@2.4: stable 2.4.6 (bottled) [keg-only]
Powerful, clean, object-oriented scripting language
https://www.ruby-lang.org/
/usr/local/Cellar/ruby@2.4/2.4.6 (13,890 files, 33MB)
Poured from bottle on 2019-06-09 at 19:10:17
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ruby@2.4.rb
==> Dependencies
Build: pkg-config ✘
Required: libyaml ✔, openssl ✔, readline ✔
==> Caveats
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/2.4.0/bin
You may want to add this to your PATH.
ruby@2.4 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have ruby@2.4 first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby@2.4/bin:$PATH"' >> ~/.bash_profile
For compilers to find ruby@2.4 you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby@2.4/lib"
export CPPFLAGS="-I/usr/local/opt/ruby@2.4/include"
==> Analytics
install: 455 (30 days), 2,089 (90 days), 4,269 (365 days)
install_on_request: 456 (30 days), 2,089 (90 days), 4,271 (365 days)
build_error: 0 (30 days)
gcc 找不到头文件stdio.h
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
改源安装 https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ https://mirrors.tuna.tsinghua.edu.cn/help/homebrew-bottles/