我已经google了它的地狱,似乎没有办法在OS X上安装gcc而不安装Xcode(占用1.5GB的空间).我只需要gcc,而不是Xcode附带的其他垃圾.在这一点上,我将采取任何其他类型的C编译器.
我知道我可以简单地安装Xcode,但这不是重点,因为我既没有原始安装光盘也没有快速的互联网连接.
那么......有没有人有任何建议?
编辑:对不起,如果我不清楚,但我也需要标题.我目前正在通过fink安装gcc4,它也在下载共享库.我会更新进度.
编辑2:好的,所以我用fink成功安装了gcc.但是,它几乎没用:"错误:C编译器无法创建可执行文件".谷歌搜索后,我发现没有安装Apple的开发者工具是导致错误的原因.可能是因为我需要所有只能通过Xcode获得的库,标题等.
在向Gemfile添加"gem'redcarpet'"后运行"$ bundle"时,我得到以下内容:
$ bundle
...
Using paperclip (2.3.11)
Using passenger (3.0.7)
Installing redcarpet (1.17.2) with native extensions /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/robs/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/robs/.rvm/gems/ruby-1.9.2-p180@rails-3.0/gems/redcarpet-1.17.2 for inspection.
Results logged to /Users/robs/.rvm/gems/ruby-1.9.2-p180@rails-3.0/gems/redcarpet-1.17.2/ext/redcarpet/gem_make.out
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `block in build_extensions'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `each'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `build_extensions'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `block in install'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
...
from /Users/robs/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.15/bin/bundle:13:in `<top …Run Code Online (Sandbox Code Playgroud) 我在OS X 10.8上使用XCode 4.4,Ruby 1.9.3和Rails 3.2.
当我从git克隆我的rails项目并运行时:
bundle install
Run Code Online (Sandbox Code Playgroud)
我明白了:
安装json(1.7.4)Errno :: EPERM:不允许操作 - /Users/myuser/.rvm/gems/ruby-1.9.3-p0/gems/json-1.7.4/.gitignore安装json时出错(1.7.4),而Bundler无法继续.gem install json -v '1.7.4'在捆绑之前确保成功.
然后我尝试:
gem install json -v '1.7.4'
Run Code Online (Sandbox Code Playgroud)
得到:
错误:执行gem时...(Errno :: EPERM)不允许操作 - /Users/scalessec/.rvm/gems/ruby-1.9.3-p0/gems/json-1.7.4/.gitignore
好的.权限问题,对吧?我们试试吧:
sudo gem install json -v '1.7.4'
Run Code Online (Sandbox Code Playgroud)
不行.这是我得到的:
构建原生扩展.这可能需要一段时间...错误:安装json时出错:错误:无法构建gem原生扩展.
/Users/myuser/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb创建Makefile
make compiling generator.c make:/usr/bin/gcc-4.2:Permission denied make:* [generator.o]错误1
有没有搞错?
我正在尝试在OS X Leopard(10.5.8)中的RVM托管Ruby 1.8.7安装下安装Nokogiri gem.
我收到以下错误:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... no
-----
The function 'xmlHasFeature' is missing from …Run Code Online (Sandbox Code Playgroud) 我刚刚升级到OS X 10.8"Mountain Lion",我开始后悔这样做了.
我不再能够构建使用OpenMP的(简单)并行代码.
通过在这里和那里看,我明白Apple不再使用'gcc'而是'llvm' - 很可能是由于与许可相关的问题.不幸的是'llvm'不支持OpenMP.
我不敢相信很多基于OpenMP的程序在OS X上不再运行,所以我的问题是:如何在Mountain Lion中启用OpenMP?
在阅读了Hristo Iliev的优秀答案之后,我想我失去了比我最初想象的更多.
我没有使用XCode.该建筑基于CMake和make/gcc.昨天我通过macports安装了gcc 4.2,但是 - 截至今天 - 我的代码仍然是源代码形式,因为 - 由于一些奇怪的原因 - 我无法将编译切换到gcc(与OpenMP相关的相同错误).
现在的问题是CMake继续使用llvm编译器.在根CMakeLists.txt中,我添加了以下两行:
set(CMAKE_C_COMPILER "/opt/local/bin/gcc-apple-4.2")
set(CMAKE_CXX_COMPILER "/opt/local/bin/gcc-apple-4.2")
Run Code Online (Sandbox Code Playgroud)
我还添加了两个环境变量:
export CXX=/opt/local/bin/gcc-apple-4.2
export CC=/opt/local/bin/gcc-apple-4.2
Run Code Online (Sandbox Code Playgroud)
当CMake尝试查找OpenMP(FIND_PACKAGE(OpenMP))时,我得到以下输出:
-- The compiler is /opt/local/bin/gcc-apple-4.2
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
[...]
CMake Error at /opt/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find OpenMP (missing: OpenMP_C_FLAGS OpenMP_CXX_FLAGS)
Call Stack (most recent call first):
/opt/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
/opt/local/share/cmake-2.8/Modules/FindOpenMP.cmake:159 (find_package_handle_standard_args)
demo/CMakeLists.txt:8 …Run Code Online (Sandbox Code Playgroud) 我在Yosemite上使用rvm安装ruby 1.9.2时遇到错误.有人能帮助我吗?我更新了homebrew和rvm.我在这个项目上和其他人一起工作,所以我无法升级ruby.我在下面输入了我的输出.提前谢谢!
Kanyons-MacBook-Pro:~ USERNAME$ rvm install 1.9.2-head
ruby-1.9.2-head - #removing src/ruby-1.9.2-head..
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/USERNAME/.rvm/rubies/ruby-1.9.2-head, this may take a while depending on your cpu(s)...
HEAD is now at 5d9f08f bump patchlevel
From git://github.com/ruby/ruby
* branch ruby_1_9_2 -> FETCH_HEAD
Current branch ruby_1_9_2 is up to date.
Copying from repo to src path...
ruby-1.9.2-head - #applying patch /Users/USERNAME/.rvm/patches/ruby/1.9.2/head/r42282.patch.
ruby-1.9.2-head - #applying patch /Users/USERNAME/.rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.9.2-head - …Run Code Online (Sandbox Code Playgroud) OSX Lion,Xcode 4.2,GCC 4.2
我在安装bson_ext 1.4.1时遇到以下错误
Building native extensions. This could take a while...
ERROR: Error installing bson_ext:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for asprintf()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Run Code Online (Sandbox Code Playgroud) 当我运行bundle install时,它会卡在最后.
这是我的捆绑控制台输出
! ? ~/r/mangoweb ? ? master ? bundle install Sun Jul 27 12:45:28 IST 2014
Updating git://github.com/mongoid/mongoid.git
Updating git://github.com/Rameshv/mongoid-paranoia.git
Updating git://github.com/resque/resque.git
Updating git://github.com/zapnap/resque_mailer.git
Updating git://github.com/michaeldv/awesome_print.git
Updating https://github.com/stripe/stripe-ruby
Updating git://github.com/thedarkone/rails-dev-boost.git
Updating git@github.com:capistrano/rvm.git
Fetching gem metadata from http://rubygems.org/.......
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.40
Using activesupport 4.0.2
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using …Run Code Online (Sandbox Code Playgroud) 我正在尝试在ruby rails上创建我的第一个应用程序.
创建我自己的项目所需的所有步骤---- 请参阅此处
在ruby控制台中我键入:
sudo rails new helloworld
Run Code Online (Sandbox Code Playgroud)
..然后它会做一些创造性的东西,直到它击中以下几行:
run bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1) …Run Code Online (Sandbox Code Playgroud) 所以我尝试使用以下命令从 PyPI 安装一个包:
sudo pip3 install switcheo
Run Code Online (Sandbox Code Playgroud)
但最终安装包失败。
Error checking for conflicts.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2584, in version
return self._version
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, in __getattr__
raise AttributeError(attr)
AttributeError: _version
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 503, in _warn_about_conflicts
package_set, _dep_info = check_install_conflicts(to_install)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
package_set, _ = create_package_set_from_installed()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
package_set[name] = PackageDetails(dist.version, dist.requires())
File …Run Code Online (Sandbox Code Playgroud) 我在10.8.3 OSX系统上安装了rvm,虽然它似乎已正确安装但没有安装红宝石.我跑了rvm install,似乎什么也没发生.
$ rvm install ruby-2.0.0-p0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Already up-to-date.
Certificates in '/Users/disaacs/.rvm/etc/openssl/cert.pem' already are up to date.
$ rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.
Run Code Online (Sandbox Code Playgroud)
我也尝试过sudo rvm install,但这没有任何区别.
关于我失踪的任何想法?
编辑:rvm requirements …