Hotcocoa installation path error - macos

I have installed MacRuby 0.6 and then the hotcocoa gem from Github. However, when I try to create a hotcocoa application with eg.
hotcocoa demoapp
I get the error
-bash: /usr/local/bin/hotcocoa: No such file or directory
Typing 'which hotcocoa' results in
/usr/bin/hotcocoa
Other online documentation seems to suggest that this ought to have been installed to /usr/local/bin so I am confused (a) how it ended up here and (b) why it can't be found even though both locations are in my PATH
I installed hotcocoa with:
sudo macgem install hotcocoa
I had previously done a gem install by mistake but I uninstalled that when I realised I should be using macgem instead.
echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec
Any thoughts?
Addendum
As an experiment, I also changed the order of the items in the PATH and it can now find hotocoa. My PATH is now...
/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/local/bin:/bin:/sbin:/usr/sbin:/usr/libexec
..with /usr/bin listed earlier than /usr/local/bin
Of course this still doesn't explain why it couldn't find it before (all the path elements seem to exist) or why it was installed there.

Thank you for sharing your experience! I've been struggling with the same set of issues and outcomes for a while. Path order was a non-issue in my case.
It appears that for MacRuby 0.7.1 (installed via RVM) with hotcocoa (installed via sudo macgem), the use of 'sudo' is required to avoid potential load errors.
For example:
(1) keying in 'hotcocoa mydemo', displays the 'Could not find RubyGem hotcocoa (>= 0) (Gem::LoadError)' message on my box. Whereas, if I key in 'sudo hotcocoa mydemo', no load error occurs and, Rakefile, config, lib, and resources items can be listed in the 'mydemo' directory.
(2) keying in 'macrake' results in rake aborted: no such file to load -- hotcocoa/application_builder. Whereas, keying in 'sudo macrake' displays the Mydemo window and its 'Hello from HotCocoa' message.

I actually found that installing hotcocoa without the sudo command worked.

Related

Tar a bundler project and send to another system

I have two systems that use the same command line interface written in ruby. One system is using an older version that's incompatible with the scripts we have written. We'd like to use bundler to download all the dependencies for the 2.0 on our own system, and then migrate that bundle over to the system with the older version so that we can use 2.0 there as well.
We do not have the option to run bundle install on the other system because it's not open to the internets.
So the idea is on my system:
bundle init
...write Gemfile...
bundle install
tar -czf cli2.0.tar.gz ./Gemfile ./Gemfile.lock ./.bundle ./bundle
... move cli2.0.tar.gz to the other system ...
On system B:
tar -zxf cli2.0.tar.gz
bundle exec cli2.0 version
But at this point we get an error stating that bundler couldn't find any of the gems even though they're right there under ./bundle/ruby/2.3.0/!!
It looks like they have different versions of ruby, and ruby-gems installed.
Received some help from a coworker, the gist is I was doing it all wrong.
If you want to transport gems and see consistent performance with bundler do this.
bundle install <gem>
bundle package
This creates a cache of the downloaded gems for transport.
tar -czf ./transport.tar.gz ./Gemfile ./Gemfile.lock ./vendor
On the next machine:
tar -xzf ./transport.tar.gz
bundle exec <command>
Might be worth a try to make your second Gemfile (the one without internet access) reference the gems using paths.
i.e.
gem some_gem, path: "/home/you/some_path/some_gem"
See this question for more info on that.
If you don't have internet access but can transfer over files, it might be worth transferring the source code for a new version of bundler/RubyGems as well.

Gem "Malformed Version Number String"

I'm building a gem. I just got the basic project structure laid out, and I tried building it with gem build my_gem.gemspec, which worked fine. Then I installed it with gem install My\ Gem-0.0.1.gem and it still looked like it worked fine. Then I tried to run irb and I got this:
/Users//.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/version.rb:206:in `initialize': Malformed version number string on (ArgumentError)
I tried making some changes and saved them. I ran gem build my_gem.gemspec. Same error.
All irb, rails, and gem sub-commands are generating a stack trace with this at the top. What did I do to break all of these commands and how do I reverse it?
You should manually delete your gem:
cd $GEM_HOME
find . -path \*my_gem\*
If everything looks good (i.e. there are no files which aren't related to your gem):
find . -path \*my_gem\* -delete
Before installing your gem again, make sure you specified version in your .gemspec.
UPD.
Other locations to look for the residue of the gem:
~/.rvm/gems/ruby-<version>#global
~/.rvm/gems/ruby-<version>
/System/Library/Frameworks/Ruby.framework/
# look for "GEM PATHS" section
gem env
# rbenv paths
~/.rbenv/versions
~/.gem/
UPD2
Problem solved! Steps taken:
This showed where exactly is this particular Rubygems executable, which failed to load:
rbenv which gem
# => /Users/<username>/.rbenv/versions/2.2.2/bin/gem
Then it turns out under 2.2.2 directory there were cache, doc and specifications directories, all of which contained a file or sub-directory with the residue of the broken gem. Deleting them all solved the problem.
(2016-May-24)
I solve this problem today.
I was try to learn how to write a gem. and then cause this problem.
My guess is because my gem's name contain whitespace: "hola 1c7"
and gem do not tell you how to solve this prbolem, this is annoying
you should go to:
/usr/local/lib/ruby/gems/2.3.0/specifications
delete that xxx.gemspec
in my case, my gem's name is "hola 1c7"
so I delete "hola 1c7-0.1.2.gemspec"
I think is the space cause problem.
if this not working,
try to search your gems name in /usr/local/lib/ruby/gems/
and delete all the file you can find,
in my case, first I delete
hola 1c7.1.3.2.gem from /usr/local/lib/ruby/gems/2.3.0/cache
so the command is :
/usr/local/lib/ruby/gems/2.3.0/cache$ sudo rm -rf hola\ 1c7-1.3.2.gem
and then
/usr/local/lib/ruby/gems/2.3.0/gems$ sudo rm -rf hola\ 1c7-1.3.2/
My Ruby Version : Ruby 2.3.0
My Linux Version : Ubuntu 16.04 LTS
I couldn't find the files in the reference path, or some of the other suggested paths in this post. Some thing that helped me was to first comment out the error be raised in the version.rb file on line 201. Then use the GEM PATH directory using $ gem env to find the path that had references to the gem. Make sure to remove everything from the doc, cache, and specifications folders. This finally solved my issue.

RVM, FSEvents, and CarbonCore on OS X

I'm setting up a project that uses SASS, which uses FSEvents to keep from polling the disk. It seems that this doesn't play nice with RVM, however. That means that when I run sass --watch I get this warning:
Warning: Unable to load CarbonCore. FSEvents will be unavailable.
I realize that it will still work, but I don't want to be polling my disk constantly. I want to get it working with FSEvents. The best information I could find about this was this thread:
http://groups.google.com/group/compass-users/browse_thread/thread/df7d9d0da9ec1eb1
I reinstalled my RVM Ruby (using 1.9.2) as described by Brandon Mathis and downloaded the linked RubyCocoa. However, I get an error on the first step of installing RubyCocoa:
[rvm 1.9.2] ~/Downloads/RubyCocoa-1.0.0 $ ruby install.rb config --build-universal=yes
install.rb: entering config phase...
create ext/rubycocoa/extconf.rb
create framework/GeneratedConfig.xcconfig
create framework/src/objc/Version.h
create tests/Makefile
---> framework
create /Users/xxx/Downloads/RubyCocoa-1.0.0/framework/src/objc/osx_ruby.h ...
config failed
hook /Users/xxx/Downloads/RubyCocoa-1.0.0/framework/post-config.rb failed:
No such file or directory - /Users/xxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0/ruby.h
try 'ruby install.rb --help' for usage
It looks like the problem stems from this being an older version of RubyCocoa (I notice the missing file has 1.9.1 in the path), but in the Google Groups post, Brandon Mathis says specifically to use the version he links and not the newest one.
Does anyone know how to get this configured, or have a link to a recent, hopefully simpler and clearer guide to getting FSEvents working with RVM?
Versions in question:
RVM 1.2.0
Ruby 1.9.2 patch level 136 (installed via RVM)
Mac OS X 10.6.6
HAML gem 3.0.25 (SASS is part of HAML)
Thanks!
I wrote FSSM, which is what HAML/SASS/Compass use for their filesystem watching backend. While rubycocoa isn't supported in 1.9.x, the latest git version of FSSM has pretty solid support for rb-fsevent. This library currently has other limitations, like only being able to monitor one path (parent directory is a must here), but I'm working on it. ;)
I'd highly suggest installing rb-fsevent, and then FSSM from github: https://github.com/ttilley/fssm
If you have any problems, please don't hesitate to file an issue in the tracker. FSSM is a currently maintained project, and it was originally written to help Chris Eppstein out with providing watch functionality in compass (which was later adopted in sass itself). Ease of use via these libraries is my absolute top priority.
This is kind of a lost battle. You can copy the contents of the include/ruby folder from the Ruby source code to that location /Users/xxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0/ which will let you run the config command, but after that you will get a lot of errors on the setup command and you won't be able to install it all. People say RubyCocoa doesn't work with 1.9.2 and I don't know if anyone managed to make it work.
I tried the FSSM method above, to no avail...
Gemfile now has:
group :development do
gem 'rb-fsevent'
gem 'fssm', :git => 'https://github.com/ttilley/fssm.git'
end
which installs:
fssm (0.2.6.1)
rb-fsevent (0.4.0)
Still getting this tho:
Warning: Unable to load CarbonCore. FSEvents will be unavailable.
Anyone have install steps to make FSSM work nicely?

Using curb gem and libcurl on Windows

I am trying to install the curb gem, which is libcurl bindings for Ruby, and of course I need to have "A working (lib)curl installation, with development stuff" installed on my computer. So, I went to the cURL Download Wizard and downloaded this package.
But adding the bin into my PATH does not produce improvement and I still get an error when I try to install the curb gem, such as:
extconf.rb:19: Can't find libcurl or curl/curl.h
(RuntimeError)
Even though, curl is already in the PATH.
EDIT: I also tried raking the gem, as per the instructions. It fails saying "make failed" and throwing a bunch of errors like this:
C:/Ruby/lib/ruby/gems/1.8/gems/curb-0.7.7.1/ext/curb_postfield.c:76:
undefined reference to
`_imp__curl_formadd'
Execute Below command for windows only and its works
gem install curb --platform=mswin32
I realise this is a very old question, but I had this exact problem today and found the instructions on someone else's site. These worked for me so I thought I would share them since people with this issue are most likely to come across StackOverflow first: http://jes.al/2012/10/installing-curb-gem-on-windows-7/
In a nutshell:
Get the 32-bit development version of curl (see my notes below)
Add the curl bin directory to your PATH
Run the following command (replacing the paths to curl as necessary)
gem install curb --platform=ruby -- -- --with-curl-lib="C:/curl-7.27.0-devel-mingw32/bin" --with-curl-include="C:/curl-7.27.0-devel-mingw32/include"
A couple of personal notes:
Even though I am on 64-bit Windows 7, I had to download the 32-bit libcurl version under "Win32 - Generic", identified as "Win32 2000/XP zip".
I got the error c:/Ruby193/lib/ruby/1.9.1/mkmf.rb:246:in 'initialize': Permission denied - mkmftmp1.log (Errno::EACCES) while installing the gem. This rather messed up page here suggested that it might be a problem with my anti-virus, and that just retrying a couple of times might work, and indeed, it did.

cannot install ruby gems - zlib error

I'm trying to install some Ruby Gems so I can use Ruby to notify me when I get twitter messages. However, after doing a gem update --system, I now get a zlib error every time I try and do a gem install of anything. below is the console output I get when trying to install ruby gems. (along with the output from gem environment).
C:\data\ruby>gem install twitter
ERROR: While executing gem ... (Zlib::BufError)
buffer error
C:\data\ruby>gem update --system
Updating RubyGems
ERROR: While executing gem ... (Zlib::BufError)
buffer error
C:\data\ruby>gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.2.0
- RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
- INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
- RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
- EXECUTABLE DIRECTORY: c:/ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mswin32-60
- GEM PATHS:
- c:/ruby/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
Found it! I had the same problem on windows (it appeared suddenly without me doing an update, but whatever):
It has something to do with multiple conflicting zlib versions (I think).
In ruby/lib/ruby/1.8/i386-msvcrt, make sure that there exists a zlib.so file. In my case, it was already there. If not, you may try to install ruby-zlib.
Then go to ruby/lib/ruby/site_ruby/1.8./i386-msvcrt and delete the zlib.so file there.
In ruby/bin, there should be a zlib1.dll. For some reason my Ruby version did not use this dll. I downloaded the most recent version (1.2.3) and installed it there. I had to rename it to zlib.dll for it to be used.
And tada! Rubygems worked again.
Hope this helps.
Firstly, I thank the person, who came up with the solution to the missing zlib problem. (It wasn't me. :-)
Unfortunately I lost the link to the original posting, but the essence of the solution on Linux is to compile the Ruby while zlib header files are available to the Ruby configure script. On Debian it means that zlib development packages have to be installed before one starts to compile the Ruby.
The rest of my text here does not contain anything new and it is encouraged to omit it, if You feel comfortable at customizing Your execution environment at UNIX-like operating systems. The following is a combination of a brief intro to some basics and step by step instructions.
------The-start-of-the-HOW-TO-------------------------
If one wants to execute a program, let's say, irb, from a console, then the file named irb is searched from folders in an order that is described by an environment variable called PATH. It's possible to see the value of the PATH by typing to a bash shell (and pressing Enter key):
echo $PATH
For example, if there are 2 versions of irb in the system, one installed by the "official" package management system, let's say, yum or apt-get, to /usr/bin/irb and the other one that is compiled by the user named scoobydoo and resides in /home/scoobydoo/ourcompiledruby/bin then the question arises, which one of the two irb-s gets executed.
If one writes to the
/home/scoobydoo/.bashrc
a line like:
export PATH="/home/scoobydoo/ourcompiledruby/bin:/usr/bin"
and restarts the bash shell by closing the terminal window and opening a new one, then by typing irb to the console, the
/home/scoobydoo/ourcompiledruby/bin/irb gets executed. If one wrote
export PATH="/usr/bin:/home/scoobydoo/ourcompiledruby/bin"
to the
/home/scoobydoo/.bashrc
,then the /usr/bin/irb would get executed.
In practice one wants to write
export PATH="/home/scoobydoo/ourcompiledruby/bin:$PATH"
because this prepends all of the values that the PATH had prior to this assignment to the /home/scoobydoo/ourcompiledruby/bin. Otherwise there will be problems, because not all common tools reside in the /usr/bin and one probably wants to have multiple custom-built applications in use.
The same logic applies to libraries, except that the name of the environment variable is LD_LIBRARY_PATH
The use of the LD_LIBRARY_PATH and PATH allow ordinary users, who do not have root access or who want to experiment with not-that-trusted software, to build them and use them without needing any root privileges.
The rest of this mini-how-to assumes that we'll be building our own version of ruby and use our own version of it almost regardless of what is installed on the system by the distribution's official package management software.
1)=============================
First, one creates a few folders and set the environment variables, so that the folders are "useful".
mkdir /home/scoobydoo/ourcompiledruby
mkdir -p /home/scoobydoo/lib/our_gems
One adds the following 2 lines to the
/home/scoobydoo/.bashrc
export PATH="/home/scoobydoo/ourcompiledruby/bin:$PATH"
export GEM_HOME="/home/scoobydoo/lib/our_gems"
Restart the bash shell by closing the current terminal window and opening a new one or by typing
bash
on the command line of the currently open window.
The changes to the /home/scoobydoo/.bashrc do not have any effect on terminal windows/sessions that were started prior to the saving of the modified version of the /home/scoobydoo/.bashrc
The idea is that the /home/scoobydoo/.bashrc is executed automatically at the start of a session, even if one logs on over ssh.
2)=============================
Now one makes sure that the zlib development packages are available on the system. As of April 2011 I haven't sorted the details of it out, but
apt-get install zlibc zlib1g-dev zlib1g
seems to be sufficient on a Debian system. The idea is that both, the library file and header files, are available in the system's "official" search path. Usually apt-get and alike place the header files to the /usr/include and library files to the /usr/lib
3)=============================
Download and unpack the source tar.gz from the http://www.ruby-lang.org
./configure --prefix=/home/scoobydoo/ourcompiledruby
make
make install
4)=============================
If a console command like
which ruby
prints to the console
/home/scoobydoo/ourcompiledruby/bin/ruby
then the newly compiled version is the one that gets executed on the command
ruby --help
5)=============================
The rest of the programs, gem, irb, etc., can be properly executed by using commands like:
ruby `which gem` install rake
ruby `which irb`
It shouldn't be like that but as of April 2011 I haven't figured out any more elegant ways of doing it. If the
ruby `which gem` install rake
gives the zlib missing error again, then one should just try to figure out, how to make the zlib include files and library available to the Ruby configure script and recompile. (Sorry, currently I don't have a better solution to offer.)
May be a dirty solution might be to add the following lines to the
/home/scoobydoo/.bashrc
alias gem="`which ruby` `which gem` "
alias irb="`which ruby` `which irb` "
Actually, I usually use
alias irb="`which ruby` -KU "
but the gem should be executed without giving the ruby the "-KU" args, because otherwise there will be errors.
------The-end-of-the-HOW-TO------------------------
I just started getting this tonight as well. Googling turned up a bunch of suggestions that didn't deliver results
gem update --system
and some paste in code from jamis that is supposed to replace a function in package.rb but the original it is supposed to replace is nowhere to be found.
Reinstalling rubygems didn't help. I'm reinstalling ruby right now.........and it is fixed. Pain though.
How about cd into rubysrc/ext/zlib, then ruby extendconf.rb, then make, make install.
After do that, reinstall ruby.
I did this on ubuntu 10.04 and was successful.
A reinstall of Ruby sorted this issue out. It's not what I wanted; I wanted to know why I was getting the issue, but it's all sorted out.
It most often shows up when your download failed -- i.e. you have a corrupt gem, due to network timeout, faulty manual download, or whatever. Just try again, or download gems manually and point gem at the files.
if gem update --system not works and rename ruby/bin/zlib1.dll to zlib.dll not helps try:
Open file RUBY_DIR\lib\ruby\site_ruby\1.8\rubygems.rb
And replace existed def self.gunzip(data) by this:
def self.gunzip(data)
require 'stringio'
require 'zlib'
data = StringIO.new data
# Zlib::GzipReader.new(data).read
data.read(10) # skip the gzip header
zis = Zlib::Inflate.new(-Zlib::MAX_WBITS)
is = StringIO.new(zis.inflate(data.read))
end
Try updating ZLib before you do anything else. I had a similar problem on OS X and updating Compress::Zlib (a Perl interface to ZLib) cured it - so I think an old version of ZLib (is now 1.2.3) may be where your problem lies...
install pure ruby zlib if all else fails

Resources