How to use macports and homebrew package management systems together? - macos

How to use macports and homebrew package management systems together without having them interfere with each other in bad ways?

It's best to use just a single package manager and uninstall the others. If, for example, you want to use MacPorts, but there's a program you need that's not in MacPorts, consider filing a MacPorts port request ticket.
If you insist that you must install multiple package managers, then please install all of them in nonstandard prefixes. MacPorts' default prefix is /opt/local. Homebrew defaults to /usr/local. Fink uses /sw. Build each package manager from source manually, selecting a unique install prefix for each that is different from all of the preceding default paths. This is to ensure that software packages that have hardcoded knowledge of these package managers' default paths do not inadvertently find dependencies from the wrong package manager.
When you install a port with MacPorts, it clears most environment variables; this is to ensure that, even if you have, say, /usr/local/bin and /sw/bin in $PATH, MacPorts will not find things there. I don't know whether Homebrew and Fink do this too; if they don't, change your $PATH so that it doesn't contain locations with potential third-party dependencies, before you install anything using Homebrew or Fink.

Related

Using Local Dependencies with Homebrew

Is there a way to get Homebrew to recognize that a dependency is already installed outside of Homebrew?
For example, I prefer to install programming languages via a tool like asdf/nvm/rvm/etc so I can easily manage multiple versions. However, if a Homebrew formula lists node, for example, as a dependency, Homebrew will install another version of node that will never actually get used.
Can I tell it I already have node installed?
Homebrew is build/distribution tool, it does not manage user specific stuff nor it does have permissions to do it.
brew install process is in install.rb, you can check out more for details.
All the core team maintained formula are in homebrew-core and cask formula are in homebrew-cask.

macOS Package Managers: Using Nix alongside Homebrew?

I was wondering if there would be any issues with installing Nix and Homebrew on the same system?
I know Homebrew tends to install things all over different directories, but from what I have read, Nix is very clean. If I understand this correctly, Nix installs it's packages all within one single directory.
So if this is the case, could I try running them both side-by-side? I would be careful not to install too many of the same packages from both places in (ie. I wouldn't install grep, htop, or whatever else from both Homebrew and Nix and if I did I would take precautions).
Side-note: This would not be permanent. I am thinking about switching from Homebrew to Nix (just to mix things up a bit), and I wanted to try Nix on my main machine before taking the leap (if at all). I know I could just try Nix on a VM, but I would not get the same experience unless I tried it on my main system. So it would be nice to install it along Homebrew and give it a shot before going through the pains of removing Homebrew and replacing all my Homebrew packages with Nix packages.
Yes, you can install Nix along side Homebrew.
Nix will install all it's packages within /nix/store For example, on my NixOS system vim is currently installed in /nix/store/j6nrk9h1rpxrzmccm0yq520ik625gd1q-vim-8.1.0578
Your shell will choose whether to use a package from Nix or Homebrew, according to how $PATH is set up. For example, if it so happens that the Nix paths are first, then they will take precedence.
Note
A common source of confusion is that install means something different on Nix. When you install a package, such as Python, it becomes part of a Nix environment, and as such can be executed without specifying the full path; Just as you'd expect from any package manager.
However, if you install a package which has, say, Python, as a dependency, Python would get installed, but more likely than not it would not be included in the environment. Hence it can only be executed via the absolute path.
On a related note, due to a similar reason, if you install a library with Nix and then try to compile against it outside of Nix, it will not work; The build tools will not find the library.

Stand alone package installing for ActivePerl

I have a standard installation of ActivePerl. I need to install the package that is not included to the installation.
Is there any way to install the package without using ppm / CPAN? (it is supposed to be installed as part of other program)
NOTE: It supposed to work under Windows
A Perl package is an ephemeral store of subroutines and package variables in memory. Perhaps you mean a Perl distribution?
First, install cpanm if you don't already have it.
cpan App::cpanminus
Yes, this works on Windows. No, you don't have to install a compiler. cpan will do that for you if necessary.
Then, install the distribution by passing its file name to cpanm. For example,
cpanm IPC-System-Simple-1.21.tar.gz
This will perform the required configuration, install the indicated prerequisites, prepare the distribution's content for installation (e.g. by building any files that need building), run the distribution's tests and install the distribution.

installing scipy on mac 10.6.8

I try to install scipy on my mac 10.6.8 but always have problem with it. I've installed ipython (sudo /usr/bin/easy_install-2.6 ipython) and numpy (python setup.py build/install), but when I installed scipy by the same way, I got always this error message:
RuntimeError: Running cythonize failed!
Could someone tell me how to solve this problem?
Have you tried using the binaries provided for OSX? That should ensure everything works.
EDIT
The easiest way I've found to keep package dependencies under control is to use MacPorts as much as possible because unlike Homebrew, the packages are designed to work together and dependencies are (almost always) automagically installed when you try to install something.
So, first, install MacPorts using the installer for Snow Leopard. Choose the option to install ports in a unique directory like /opt/local, so they don't conflict with whatever built-in versions the OS depends on. Also, ensure that /opt/local/bin and /opt/local/sbin are added to your $PATH before the system directories like /usr/bin, /bin, /sbin etc. so that when you run python from the command prompt you get the version you want. Your ~/.profile should have something like export PATH="/opt/local/bin:/opt/local/sbin:$PATH as its last line.
After MacPorts has been installed, you may want to restart just for fun to ensure that all of your environment variable are set up properly. Start Terminal.app (or your favorite replacement) and enter which port, which should return /opt/local/bin/port if everything worked correctly. Next, run sudo port selfupdate just to make sure everything is synced properly. Once that is done, we can install python and some modules. port allows you to pass a list of ports to be installed, so a command like sudo port install foo bar baz will install the latest versions of the foo, bar, and baz ports, along with any dependencies they may require, in the correct order. Some ports have binary distributions, and others are compiled as needed, so the first time you run it there may be a lot of dependencies to install. A nice feature of MacPorts is that you can have multiple versions of some packages installed at the same time, and you can switch between them if needed. Also, if port search is giving too many results, the online search engine can help you find what you're looking for.
To get a decent IPython-based Python 2 development environment going, you'll need the following:
python27
py27-ipython
py27-numpy
py27-scipy
py27-matplotlib (if you like drawing pretty pictures, but mainly so you can get pylab)
py27-pandas (DataFrames are your friend!)
and perhaps py27-pyqt4 if you run ipython via the qtconsole option
I'd also install py-pip and py27-distribute so you can install modules on your own if there is no MacPort version.
Finally, if you're a forward-looking person and want to use numpy et al. on Python 3, MacPorts has you covered! There are py32- and py33-based versions of all of the above packages except scipy, which is only py32 for now. However, I was able to install it just fine with pip, although I have a whole bunch of other devel tools on my machine, and I'm running 10.8.2, so YMMV.
Good luck!

How to install BSD make on a Mac (while preserving GNU make)?

I have two questions regarding make on my Mac: one regarding installation of a second make flavor, the second regarding how to manage the two flavors.
I need to install BSD make on my Mac, but I don't want to remove the GNU make that is standard on the Mac; Berkeley is for a special project. In spite of the extensive resources for installing BSD, I haven't been able to figure out where to get and how to install that single program. What is the best way to do this?
I'm thinking that I'll need to put it in /usr/local/bin while GNU make, which was provided by the Mac OS developer tools, will stay where it is in /bin. Then I can manage which make is called with an alias. I'm still a *nix newbie; is this a reasonable strategy or is there a better way?
Installing BSD make
If you don't already have a /usr/bin/bsdmake (apparently it used to come with OS X/Xcode, but no longer does), install Homebrew, then:
brew install bsdmake
GNU co-habitation
To avoid conflicts with GNU make, Homebrew will install BSD make as bsdmake. In most cases it should be sufficient to build your software with bsdmake all. Sometimes you may have to tell it that your BSD make is called bsdmake and not make.
Removal
If you decide to get rid of BSD make for whatever reason, Homebrew will be happy to clean up for you by invoking:
brew uninstall bsdmake
Install macports and then use it to install bsdmake or bmake. They will be installed into /opt/local/bin (you will have to adjust your $PATH within your ~/.profile to access them easily).

Resources