I had dart sass in my macOS Sierra(version 10.12.6). I uninstalled it to install ruby sass, the installation seems to be successful but when I check the version of sass I am getting an error message
$ gem install sass -v3.5.2
Successfully installed sass-3.5.2
Parsing documentation for sass-3.5.2
Done installing documentation for sass after 2 seconds
1 gem installed
Danys-MacBook-Pro:<FOLDERNAME> danyjose$ sass --version
-bash: /Users/danyjose/.nvm/versions/node/v6.0.0/bin/sass: No such file or directory`
I cannot figure out what I am missing here.
I am not able to install and run fakes3 gem on El Capitan Beta 5.
I tried:
sudo gem install fakes3
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/fakes3
Then I tried doing it the cocoapods way. It worked for cocoapods but not for fakes3.
mkdir -p $HOME/Software/ruby
export GEM_HOME=$HOME/Software/ruby
gem install cocoapods
[...]
1 gem installed
gem install fakes3
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Disclaimer: #theTinMan and other Ruby developers often point out not to use sudo when installing gems and point to things like RVM. That's absolutely true when doing Ruby development. Go ahead and use that.
However, many of us just want some binary that happens to be distributed as a gem (e.g. fakes3, cocoapods, xcpretty …). I definitely don't want to bother with managing a separate ruby. Here are your quicker options:
Option 1: Keep using sudo
Using sudo is probably fine if you want these tools to be installed globally.
The problem is that these binaries are installed into /usr/bin, which is off-limits since El Capitan. However, you can install them into /usr/local/bin instead. That's where Homebrew install its stuff, so it probably exists already.
sudo gem install fakes3 -n/usr/local/bin
Gems will be installed into /usr/local/bin and every user on your system can use them if it's in their PATH.
Option 2: Install in your home directory (without sudo)
The following will install gems in ~/.gem and put binaries in ~/bin (which you should then add to your PATH).
gem install fakes3 --user-install -n~/bin
Make it the default
Either way, you can add these parameters to your ~/.gemrc so you don't have to remember them:
gem: -n/usr/local/bin
i.e. echo "gem: -n/usr/local/bin" >> ~/.gemrc
or
gem: --user-install -n~/bin
i.e. echo "gem: --user-install -n~/bin" >> ~/.gemrc
(Tip: You can also throw in --no-document to skip generating Ruby developer documentation.)
In my case, I had to re-install Ruby using Brew. That seems to have solved the problem as I can install gems again.
brew install ruby
After this, you need to log out and log back in, either graphically or just restarting your terminal.
That is because of the new security function of OS X "El Capitan".
Try adding --user-install instead of using sudo:
$ gem install *** --user-install
For example, if you want to install fake3 just use:
$ gem install fake3 --user-install
sudo gem install -n /usr/local/bin cocoapods
Try this. It will definately work.
You have to update Xcode to the newest one (v7.0.1) and everything will work as normal.
If after you install the newest Xcode and still doesn't work try to install gem in this way:
sudo gem install -n /usr/local/bin GEM_NAME_HERE
For example:
sudo gem install -n /usr/local/bin fakes3
sudo gem install -n /usr/local/bin compass
sudo gem install -n /usr/local/bin susy
Looks like when upgrading to OS X El Capitain, the /usr/local directory is modified in multiple ways :
user permissions are reset (this is also a problem for people using Homebrew)
binaries and symlinks might have been deleted or altered
[Edit] There's also a preliminary thing to do : upgrade Xcode...
Solution for #1 :
$ sudo chown -R $(whoami):admin /usr/local
This will fix permissions on the /usr/local directory which will then help both gem install and brew install|link|... commands working properly.
Solution to #2 :
Ruby based issues
Make sure you have fixed the permissions of the /usr/local directory (see #1 above)
First try to reinstall your gem using :
sudo gem install <gemname>
Note that it will install the latest version of the specified gem.
If you don't want to face backward-compatibility issues, I suggest that you first determine which version of which gem you want to get and then reinstall it with the -v version. See an exemple below to make sure that the system won't get a new version of capistrano.
$ gem list | grep capistrano
capistrano (3.4.0, 3.2.1, 2.14.2)
$ sudo gem install capistrano -v 3.4.0
Brew based issues
Update brew and upgrade your formulas
$ brew update
$ brew upgrade
You might also need to re-link some of them manually
$ brew link <formula>
As it have been said, the issue comes from a security function of Mac OSX since "El Capitan".
Using the default system Ruby, the install process happens in the /Library/Ruby/Gems/2.0.0 directory which is not available to the user and gives the error.
You can have a look to your Ruby environments parameters with the command
$ gem env
There is an INSTALLATION DIRECTORY and a USER INSTALLATION DIRECTORY. To use the user installation directory instead of the default installation directory, you can use --user-install parameter instead as using sudo which is never a recommanded way of doing.
$ gem install myGemName --user-install
There should not be any rights issue anymore in the process. The gems are then installed in the user directory : ~/.gem/Ruby/2.0.0/bin
But to make the installed gems available, this directory should be available in your path. According to the Ruby’s faq, you can add the following line to your ~/.bash_profile or ~/.bashrc
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
Then close and reload your terminal or reload your .bash_profile or .bashrc (. ~/.bash_profile)
This is the solution that I have used:
Note: this fix is for compass as I wrote it on another SO question, but I have used the same process to restore functionality to all terminal processes, obviously the gems you are installing are different, but the process is the same.
I had the same issue. It is due to Apple implementing System Integrity Protection (SIP). You have to first disable that...
Reboot in recovery mode:
Reboot and hold Command + R until you see the apple logo.
Once booted select Utilities > Terminal from top bar.
type: csrutil disable
then type: reboot
Once rebooted
Open terminal back up and enter the commands:
sudo gem uninstall bundler
sudo gem install bundler
sudo gem install compass
sudo gem install sass
sudo gem update --system
The the individual gems that failed need to be fixed, so for each do the following:
On my machine this was the first dependency not working so I listed it:
sudo gem pristine ffi --version 1.9.3
Proceed through the list of gems that need to be repaired. In all you are looking at about 10 minutes to fix it, but you will have terminal commands for compass working.
Screenshot
If the gem you are trying to install requires xml libraries, then try this:
sudo gem install -n /usr/local/bin <gem_name> -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
Specifically, I ran into a problem while installing the nokogiri gem v 1.6.8 on OS X El Capitan
and this finally worked for me:
sudo gem install -n /usr/local/bin nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
To make sure you have libxml2 and libxslt installed, you can do:
brew install libxml2 libxslt
brew install libiconv
and then check to make sure you have xcode command line tools installed:
xcode-select --install
should return this error:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Reinstalling RVM worked for me, but I had to reinstall all of my gems afterward:
rvm implode
\curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm reload
I ran across the same issue after installing El Capitan, I tried to install sass and compass into a symfony project, the following command returned the following error:
$ sudo gem install compass
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ffi.h... /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
So I then tried to install sass with:
$ sudo gem install sass
Got the same error message, after some googling I managed to install sass using the following command:
$ sudo gem install -n /usr/local/bin sass
The above worked for me with installing sass but did not work for installing compass. I read that someone somewhere had opened an instance of xcode then closed it again, then successfully ran the same command after which worked for them.
I attempted to open xcode but was prompted with a message saying that the version of xcode installed was not compatible with El Capitan.
So I then updated xcode from the app store, re-ran the following command which this time ran successfully:
$ sudo gem install -n /usr/local/bin compass
I was then able to run $ compass init
I now have all my gems working and can proceed to build some lovely sass stuff :)
I had to rm -rf ./vendor then run bundle install again.
You might have two options:
If you've installed ruby and rails, you can first try running the command:
rvm fix-permissions
You can uninstall ruby completely, and reinstall in your ~ directory aka your home directory.
If you're using homebrew the command is:
brew uninstall ruby
For rails uninstall without homebrew the command is:
rvm remove
This should reinstall the latest ruby by running command:
curl -L https://get.rvm.io | bash -s stable --rails<br>
Mac has 2.6.3 factory installed, and it's required... if not run this command:
rvm install "ruby-2.6.3"
and then:
gem install rails
You'll get a few error messages at the end saying you have to add some other bundles...
Just make sure you're in the home ~ directory when you're installing so the permissions won't be an issue, but just in case...
I again ran:
rvm fix-permissions
and:
rvm debug
which told me I had to download yarn, I didn't save the output for it. Basically I did whatever the prompt told me to do if it had to do with my OS.
-D
I don't like to install stuff with sudo.
once you start with sudo you can't stop..
try giving permissions to the Gems directory.
sudo chown -R $(whoami) /Library/Ruby/Gems/2.0.0
sudo chown -R $(whoami):admin /usr/local
That will give permissions back (Homebrew installs ruby there)
I'm working with Sass, Compass and Susy on OSX / Terminal. But I can't get Susy to work together with Sass and Compass. What I've done:
sudo gem install sass
sass -v
Returns: Sass 3.3.0 (Maptastic Maple)
sudo gem install compass
This seems to also install sass-3.2.14.gem, then the compass-0.12.3.gem.
compass -v
returns: Compass 0.12.3 (Alnilam)
Everything until this point seems to work fine; I can create a Compass project and work with it. Then I try to install Susy:
sudo gem install susy --pre
or just
sudo gem install susy
This seems to install susy-2.0.0
Than I run:
compass create /Users/tom/Thomas/htdocs/susi4-test -r susy -u susy
And I get this error:
Gem::LoadError on line 2064 of /Library/Ruby/Site/1.8/rubygems/specification.rb: Unable to activate susy-2.0.0, because sass-3.2.14 conflicts with sass (~> 3.3.0)
Run with --trace to see the full backtrace
So there seems to be a problem with the compatibility of the different versions. What can I do to resolve this error?
The dependencies are incompatible: susy 2.0.0 depends on sass ~> 3.3.0 whereas compass 0.12.3 depends on sass = 3.2.14.
The error message says the same:
Unable to activate susy-2.0.0, because sass-3.2.14 conflicts with sass (~> 3.3.0)
You can a) downgrade susy to a version that's working with sass 3.2.14 or b) upgrade compass to a version compatible with sass 3.3.x.
A compatible version is compass 1.0.0 (or later) depending on sass < 3.5, >= 3.3.13. You can install it via
gem update compass
It might be easier to use a gem manager like Bundler. It automatically resolves dependencies and installs the appropriate versions.
gem install compass --pre
when you install compass lastest version will have error like:
ERROR: While executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: 'compass (= 1.0.0.alpha.19)' requires 'compass-core (~> 1.0.0.alpha.19)'
You should install compass-core first
gem install compass-core
The best way without a doubt is to install Susy via the Compass Susy Plugin. This will avoid conflicts with other Compass projects that require the current version.
Commands:
gem install compass
gem install compass-susy-plugin
I am trying to use SASS for the first time, i have installed the latest version but get errors in the terminal
stuarts-imac:css stuartcookney$ sass --watch main-style.scss
Sass is watching for changes. Press Ctrl-C to stop.
write main-style.css
LoadError: cannot load such file -- listen/version
Use --trace for backtrace.
It compiles the css file but something is broken as any other changes that i make they do not update.. what is wrong?
Just tried a mix of some answers, on Ubuntu 21:
First:
sudo apt-get install ruby-listen
And then:
sudo gem install sass-listen
It's now posible to sass src:dst --watch
Thank you #dimetrodon, #maxime-lorant and #kevin-mack
Lubuntu fixed with a simple:
sudo gem install sass-listen
On Linux Mint 18.1.
You can help it
sudo apt-get install ruby-listen
This is what fixed it for me and some others:
sudo gem uninstall listen --version 2.7.0
sudo gem install listen --version 2.4.1
I was receiving the same error. The output with the --trace option will contain something like the following near the top:
`require': cannot load such file -- rb-inotify
I have no experience with ruby but seems like sass is simply trying to load in a dependency which isn't there. You can use gem to resolve it:
gem install rb-inotify
I've tried all above:
gem install listen --version 2.4.1
gem install sass-listen
apt-get install ruby-listen
gem install rb-inotify
completely uninstalled sass and ruby and reinstalled.
The only thing that worked was to ditch ruby-sass completely and install dart-sass instead.
In Ubuntu (checked in Ubuntu 20)
sudo apt install sass sass-listen
I want to use qt5's QtWebKit with capybara-webkit.
brew uninstall qt
Uninstalling /usr/local/Cellar/qt/4.8.4...
brew install qt5
This formula is keg-only: so it was not symlinked into /usr/local.
🍺 /usr/local/Cellar/qt5/5.0.2: 3103 files, 140M, built in 60.9 minutes
If I force brew to create the symlinks for qt5 I can build the native extension for capybara-webkit ..
brew link --force qt5
Linking /usr/local/Cellar/qt5/5.0.2... 122 symlinks created
gem install capybara-webkit -v '1.0.0'
Successfully installed capybara-webkit-1.0.0
.. but webkit_server crashes hard ..
bundle exec rake test:integration
Errno::EADDRNOTAVAIL: Can't assign requested address - connect(2)
dyld: Library not loaded: /private/tmp/qt5-KytU/qt-everywhere-opensource-src-5.0.2/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit
Referenced from: /usr/local/opt/qt5/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
Reason: image not found
See full osx crash report.
I tried installing capybara-webkit with LDFLAGS and CPPFLAGS but webkit_server still crashes hard.
env LDFLAGS=-L/usr/local/opt/qt5/lib \
CPPFLAGS=-I/usr/local/opt/qt5/include \
gem install capybara-webkit -v '1.0.0'
NOTE: IAmNaN here... this answer worked find for El Cap and Yosemite but it is no longer relevant as of MacOS Sierra. Instead follow the instructions from Thoughtbot. To summarize...
Download and install a new Qt from here.
Edit ~/Qt5.5.1/5.5/clang_64/mkspecs/features/mac/default_pre.prf.
Around line 15 find and replace -find xcrun 2 with -find xcodebuild 2.
Save and run PATH=~/Qt5.5.1/5.5/clang_64/bin:$PATH gem install capybara-webkit
Now back to our regularly scheduled answer....
I got this to work on OSX Yosemite. The reason for building against Qt5 was to get some fixes not in Qt4 that prevented capybara-webkit from using font and stylesheet assets in some circumstances.
Comment out the capybara and capybara-webkit gems from your gemfile. Then:
bundle
gem uninstall capybara-webkit
gem uninstall capybara # if it complains about dependencies 'gem uninstall' them first
brew remove qt
brew remove qt5 # if you've been playing around
From a clean environment (restart your terminal):
brew tap homebrew/versions
brew install qt55
brew linkapps qt55
brew link --force qt55
Uncomment capybara and capybara-webkit in the gemfile and then:
bundle install
Note: You may safely ignore the "brew unlink" warnings issued by brew doctor.
Two years later, the same steps from my question now work. Thanks, whoever fixed it.
gem uninstall --all capybara-webkit
brew remove qt
brew install qt5
brew linkapps qt5 # optional?
brew link --force qt5
gem install capybara-webkit
After installing qt5, I no longer see this message from my test suite:
WARNING: The next major version of capybara-webkit will require at least version 5.0 of Qt.
Uninstalling the capybara gem is not necessary (as other answers suggest) because it has no native extensions, thus no direct dependency on QT.
According to https://github.com/thoughtbot/capybara-webkit/issues/885 , QT stopped working with webkit at version 5.6. However, there is a qt55 brew available, so use qt55 (instead of qt5) in the answers above.
I suggest to brew update, brew remove qt5 and brew install qt5, because I find on my system, that:
xcrun otool -L /usr/local/Cellar/qt5/5.0.2/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
[snip]
/usr/local/Cellar/qt5/5.0.2/src/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.0.0, current version 5.0.2)
So Qt5 does link against QtWebKit and the link is valid on my system in contrast to yours.
Therefore the suggestion to reinstall. If homebrew installs the prebuilt bottle and still has this issue, please report on Homebrew's issue tracker on github. I installed mine from source.
However, I guess an upstream issue (a minor one) is that the link points into src which should probably lib. But that is up to Qt to fix.