Keg-only homebrew formulas - macos

Today I installed the curl formula via homebrew, but after installing it (and re-sourcing the shell) i noticed that :
% which curl
/usr/bin/curl
as a matter of fact, the output of brew install curl stated that it was a keg-only formula, and that since curl was already present in OS X, it didn't link it into Homebrew prefix, as that could cause unspecified problems.
Then it proceeds stating that
Generally there are no consequences of this for you
I would like to know:
What sorts of problems exactly?
What is the purpose of installing keg-only formulas via Homebrew? How can there be no consequences if the newly installed tool is not in the PATH?

Problems: if a homebrew application is put in the path in front of the default OS X version of the same, really anything might happen. Most common issues are caused by differences between the set of command line options available in the two versions, or differences in the meaning of the options. For curl the consequences might not be so bad, but for other applications you could, at worst, break the OS.
Keg-only: now you have two versions of curl! The default OS X, and the homebrew. If you want to use features that are not in the default but in the homebrew, you can do so by calling the homebrew curl explicitly. The precise path depends on how you've got homebrew set up. Because the newly installed version is not in the path, its unlikely to cause a problem unless it is explicitly called.

I want to add some complement to the second problem(related to the mechanism of keg-only) asked by #asymmetric.
HomeBrew's prefix is /usr/local , and HomeBrew keeps all installed kegs in the default directory, say /usr/local/Cellar. In general, HomeBrew could create symlink for installed formula(non-keg-only formula), and the corresponding symlink is kept in /usr/local/bin. This symlink-creation procedure is automatic when HomeBrew installing the formula. Here the path /usr/local/bin would be called default (symlink) prefix.
On the other hand, according to FAQ of HomeBrew, we have the following guidance:
``keg-only formula is installed only into the Cellar and is not linked into the default prefix. This means most tools will not find it.''
But at the same time the HomeBrew creates symlinks in the directory /usr/local/opt for ALL installed formulae no matter whether they are keg-only or not.
There will be two crucial points we should notice:
By default the default (symlink) prefix /usr/local/bin is in PATH, but the non-prefix /usr/local/opt is NOT in PATH.
By default the default (symlink) prefix /usr/local/bin in general points towards the latest version of formula. So if you want to use the specific version(often in keg-only format) of some formula you could temporarily prepend your PATH with the keg-only formula's bin directory, for example, export PATH="$(brew --prefix)/opt/FormulaName/bin:${PATH}".
The setting of /usr/local/opt mentioned above could resolve the executable-conflict. In general, you might have a formula or program in your system with many different versions, such as the latest version and outdated version, the Apple native version and locally installed version, an so on. It's possible for these situations to cause conflict when you execute or compile some other programs which are somewhat related to the current using formula or program.

Related

Mac OSX. Where can I download glibtool?

I am trying to setup watchman for the mac. As stated on the website, I need to install glibtool.
Can anyone provide a link to where I can download glibtool?
I need to be able to download it from its source and the only solution I can find is by using brew.
I do not want to use brew.
Thank you.
glibtool is "GNU Libtool". It is typically installed as libtool on most systems, but because macOS has its own libtool that has completely different functionality, it is usually installed as glibtool on macOS.
If you can't directly use homebrew to install it, you can duplicate the steps in its recipe, which you can find here: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libtool.rb
For the sake of keeping this answer "working" even if homebrew goes away, the homepage for libtool is https://www.gnu.org/software/libtool/ and you can follow the instructions there for information on how to build and install it.
I've covered similar issues to Wez's answer from a MacPorts perspective; I'll go ahead and assume you can't use that either.
The latest stable version at this time is 2.4.6. Typical best practice is to make a directory, e.g., build in the top level of the source. Add the prefix: g, with --program-prefix=g, the top level installation directory --prefix=PREFIX, or specify more fine-grained installation directories options for bin, include, lib, and share directories.
> mkdir build
> cd build
> ../configure --prefix=/my/install/path --program-prefix=g
> make; make install
You now have glibtool and glibtoolize in $PREFIX/bin.

Homebrew doctor is foreshadowing some sinister problems

I'm trying get Homebrew working with Xcode Command Line Tools, and they seem to be having it out with each other... In the words of Rodney King, "Can't we all just get along?"
For some background, when I first got my Mac about a year ago, I had no idea what I was doing. I was also using macports, which was, as the Homebrew website seems to be cognizant, driving me to become a raging alcoholic. As a result, my /usr/local directory got wayyy f-ed up. Eventually, gcc and g++ stopped working, and a lot of other things were breaking. So I did a clean install of OS X, and I want my shiny new installation to stay a little more organized.
Now, I've installed Apple's Command Line Tools, and all the binaries/libraries/etc have ended up in /usr/local. That's fine, but then I try to install homebrew, and it's also putting everything in the /usr/local/ directory. When I run the command
brew doctor
I get the following output (actually, this is just a snippet, but it captures the general spirit of what Homebrew is telling me):
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libatomic.a
/usr/local/lib/libgfortran.a
/usr/local/lib/libgmp.a
/usr/local/lib/libgomp.a
/usr/local/lib/libitm.a
/usr/local/lib/libmpc.a
/usr/local/lib/libmpfr.a
/usr/local/lib/libquadmath.a
/usr/local/lib/libssp.a
/usr/local/lib/libssp_nonshared.a
/usr/local/lib/libstdc++.a
/usr/local/lib/libsupc++.a
I thought I might place Homebrew in a different directory; however, the Homebrew documentation specifically warned against this. They say:
"Do yourself a favor and install to /usr/local. Some things may not build when installed elsewhere. One of the reasons Homebrew just works relative to the competition is because we recommend installing to /usr/local. Pick another prefix at your peril!"
The whole point is that I don't want to bother with micro-managing every package I install, and I don't want my filesystem to become an ungodly mess either. Anyone have any suggestions? Do I move command line tools to a different directory and add this to my $PATH? Any tips would be much appreciated.
It's a warning, and the message says why. If you later want to install a Homebrew formula that installs one of those files, it will fail, because it will decline to overwrite those files, and then you will have to delete those files, as the message says.
Specifically, those files appear to belong to an installation of gcc. You might want to research or try to remember why that was installed there. It's probably OK to just delete them and install gcc from Homebrew if you need it.

Trying to install ruby in Mac OS X

So i'm new with this. I'm trying to install ruby on my mac with mountain lion.
im following this guide:http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
when I put "brew doctor" I get this lot of warnings:
$ brew doctor
Warning: /Library/Frameworks/Mono.framework detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake.
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libusb-0.1.4.dylib
/usr/local/lib/libusb-1.0.0.dylib
/usr/local/lib/libusbpp-0.1.4.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libusb.la
/usr/local/lib/libusbpp.la
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/fuse.pc
/usr/local/lib/pkgconfig/libusb.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libusb.a
/usr/local/lib/libusbpp.a
What should I do? What's happening?
I would recommend that you manage your ruby installations with either RVM or RBENV it will make your life much easier to manage different versions, upgrades, etc.
Use RVM. RVM allows you to install and manage multiple versions of Ruby on the same machine.
You can follow the instructions here to install RVM, and instructions here to install Ruby. The second link is an excellent beginners guide to get going with ruby-on-rails by the way.
Your Mac probably comes with Ruby 1.8.7. I like some of the features in 1.9.x, and they've recently released 2.0.0, so you may wish to upgrade. However there's no point doing work if you ain't gonna need it, so first decide whether you need a different version of Ruby right now. (And verify your current version with a ruby -v).
Assuming you need a new version, RVM and rbenv are two tools that make installing and managing (a.k.a. switching between) various Rubies and their versions very easy. Some people don't like RVM because it does some strange things (like override the definition of cd - change directory), but I find it simpler to use, and doesn't require you to remember to rehash every time. Read up on it and decide for yourself.
If you want to use RVM:
Install it (Google to find out how).
Make sure to source the script that it tells you to do in the output during the installation.
Start using it: rvm install <version> (e.g. rvm install 1.9.3), rvm use <version> (to switch between versions), rvm list (to see which Rubies you have installed), etc.
RVM has more online resources so it's be a good choice since you're starting. Pay attention to the error logs in your console and Google them, you'll probably see some quite accurate results (as the ruby install issues are common).

Installing Ruby 1.9 on OS X Leopard using /usr/local - RVM issues

I have to run a Rails (3.0.6) app locally that requires Ruby 1.9.2 (plus Mongo). I'd like to install Ruby 1.9.2 alongside my existing 1.8.7 and be able to swap between them as necessary. I prefer installing to usr/local over Macports etc. Any recommendations? I've tried installing RVM but this has proved such a pain on OS X I'd rather avoid that too.
Is there another way of running multiple Ruby versions (maybe with a prefix like this)? I only need to switch to 1.9 for this project. Or has anyone a good solution to the known OS X/RVM install issues? Specifically, on Tiger/10.4 bash doesn't support errtrace.
Update: solved with a new RVM install script: see RVM on OS X 10.4 - possible?.
RVM really is the easiest solution, and I would highly recommend you try and work that issue out first.
The only bit of advice is to make sure you configure your PATH variable to include /usr/local/bin before everything else. In your .profile or .login (depending on your shell), you should have it towards the bottom, in case there is any other lines configuring PATH as well, and then for the Bourne shell family:
export PATH="/usr/local/bin:$PATH
or for the C shell family:
set path = (/usr/local/bin $PATH)
Running ./configure alone should make it install into /usr/local, but you can explicitly state so with
./configure --prefix=/usr/local
Install Ruby from source and it will default to /usr/local/bin. Adjust your path, the #! line, or your /usr/local/bin/ruby source.rb as necessary to switch between Apple's installation of Ruby, and the one you add.
You can force a new base directory using ./configure --prefix=/... where '...' is whatever path you want. Again, once the files are installed, you can adjust the executing Ruby with one of the above methods.
Do not attempt to remove Apple's installed Ruby. It's there for their use, not for our convenience, and Apple uses it to provide some functionality. Messing with it or removing it could break things, and you probably wouldn't notice for a while.
RE: RVM, It really is the preferred way to install a user Ruby. I have it on two Macs, and a handful of different Linux boxes and the only time I had trouble was with a secured machine behind firewalls, but I can't blame RVM for those problems when it couldn't see the internet at all. And, yes, I got it working nicely, I just had to insert the manually downloaded Ruby archives into the ~/.rvm/archives directory.
If you are having problems and want to use it, it might help to temporarily strip your startup scripts, or create a temporary user, and see what happens. Additionally, the author has been very responsive and helpful the few times I've asked him questions. Contact him at:
If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:
http://webchat.freenode.net/?channels=rvm
If you download the source and compile it, it should install into /usr/local by default, or you can
./configure --prefix=/usr/local
just to be sure.
Actually, compiling and installing ruby from source is an easy way to be sure you have the latest version, especially if you use git and github:
https://github.com/ruby/ruby

Problems with macports and patch on OSX 10.6.8

I can't seem to install anything with MacPorts. Problems inevitably arise when MacPorts gets to the stage where it tries to apply patches. It croaks because apparently /usr/bin/patch has a security patch that prevents itself from patching upwards in the directory tree. A typical error message:
:info:patch /usr/bin/patch: **** rejecting file name with ".." component: ../libunwind/include/libunwind.h
I see some various bug reports on this issue such as https://trac.macports.org/ticket/29871 and https://trac.macports.org/ticket/29813, but no real solutions.
Is there a patch to patch?
I do not use Macports (so I cannot test this possible solution), but perhaps you could try installing the GNU version of patch. There is indeed a portfile for it within Macports. It installs as gpatch, but you could easily create a symbolic link such that /opt/bin/patch -> /opt/bin/gpatch. Additionally, you will need to ensure that /opt/bin appears before /usr/bin in your path.
Although the portfile requires a patch to be applied, it fortunately does not use any .. path components.
It appears as though this security patch originated in February of 2011. As 2.6.1 predates this, I believe this method should work.

Resources