Install docker-machine on OSX WITHOUT Docker Toolbox - macos

Am I correct to assume that installing Docker Toolbox is now the required method for installing docker-machine on OSX? I have a script that I've been using for onboarding my team of developers, which installs docker related tools like docker-machine, but it pulls it in through curl. This stopped working with the latest version. All their documentation says I need to install Docker Toolbox, with no indication of an alternative. Is there still a way to install it through the command line?

I installed virtualbox, docker, docker-machine and docker-compose all via homebrew, and worked like a charm to me.
$ brew install docker docker-compose docker-machine
if you don't have installed virtualbox, you could install it using homebrew cask.
$ brew cask install virtualbox
One important thing you obtain when you installing it this way, is the bash completion. You need to install bash-completion, previously, for this benefit.
$ brew install bash-completion

Answered my own question. It's undocumented, but if you go to their github page, then click on releases, you'll see all the latest releases for the OS you're looking for. https://github.com/docker/machine/releases. Find the download you need, then run this:
$ curl -L https://github.com/docker/machine/releases/download/v0.4.0/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine
$ chmod +x /usr/local/bin/docker-machine

You can install it also with Homebrew
$ brew install docker-machine

Related

Unable to install packages via npm; can only use homebrew

I a trying to install some cli tools to use globally. Running the install command via npm never works - I get command not found [package] whenever I check [package] -v. I have tried this with netlify-cli, firebase-tools, and heroku.
However, when I install heroku via homebrew (brew tap heroku/brew && brew install heroku) it seemed to work fine. The version info showed up on heroku -v.
If it's relevant, I'm using MacOS 13.0, and ohmyzsh on iTerm2. I tried the built-in terminal (which also runs zsh) but had no luck.
How can I reliably use npm in order to install tools?

How to upgrade minikube?

I had installed minikube a few months ago and wanted to upgrade as newer versions are available.
I am unable to find out how to upgrade minikube. I see a feature request for an upgrade command here - https://github.com/kubernetes/minikube/issues/1171
I tried to then uninstall minikube and hit another brickwall again. I don't see a command to uninstall minikube. The information that came closest to this was not very helpful - https://github.com/kubernetes/minikube/issues/1043
I guess we need ways to upgrade these (at least once every 6 months or so).
Before reinstall minikube (OS X), check the following:
Make sure that you have brew updated:
brew update
Make sure that you already have cask installed:
brew cask install minikube --verbose
Finally, execute the following command in the same directory you've installed minikube previously (usually /usr/local/bin/):
brew cask reinstall minikube
If you see an output similar to this:
Error: It seems there is already a Binary at '/usr/local/bin/minikube'; not linking.
Remove the existing binary:
rm /usr/local/bin/minikube
Now, you should able to reinstall (upgrade) minikube. :)
brew upgrade minikube
Just upgrade minikube with brew
This should do the trick.
brew cask reinstall minikube
First, unlink the existing minikube from /usr/local/bin then reinstall:
$ sudo rm -rf /usr/local/bin/minikube # unlink existing minikube
$ brew update # update brew itself
$ brew cask reinstall minikube # reinstall latest minikube
An updated way is to use this:
brew cask upgrade minikube
Process to update:
Minikube is an executable: Re-install minikube is an upgrade.
Optionally you can remove ~/.minikube which will make minikube completely re-initialize and also update your kubernetes version (if a new version has been made available for minikube).
minikube delete
sudo rm -rf ~/.minikube
re-install minikube and it should work
if you are using Windows machine and Chocolatey package manager -
Step 1: run PowerShell as administrator
Step 2: run following command choco upgrade minikube
More on chocolatey https://chocolatey.org/
As of early 2020, and based on the guidance provided by this answer, minikube is no more available as a cask. You need to run:
brew install minikube
Minikube is no longer available in cask and calling brew cask while performing install, upgrade, or reinstall is deprecated! Use the below syntax instead:
Make sure brew is updated:
brew update
Then, to install, use:
brew install minikube
To upgrade, use:
brew upgrade minikube
To reinstall, use:
brew reinstall minikube
If you're reading this in 2020+:
brew upgrade minikube
On linux:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.22.0/minikube-linux-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube
Change the version you want to download. Above script uses 1.22.0
Just try brew upgrade minikube
brew reinstall minikube --cask did the trick for me
In order to upgrade in Windows, type:
minikube start
The following is the output you will get (make sure you are connected to internet):
Here is a newer version of Minikube available (v0.28.0). Download it here:
https://github.com/kubernetes/minikube/releases/tag/v0.28.0
if you don't get the above message then first run
minikube config set WantUpdateNotification true
then do,
minikube start
Before that, remove all the Minikube links from the system:
Remove the previous installation path.
From this folder, remove c:\Users\<user-name>\ .kube folder.

Automated installation with Brew/cask in apps folder

I want create an automated script to use on a post installation.
For this reason i want use brew and cask to make it all.
So, i think that my script should start with that to install brew:
echo << "Installing homebrew..."
if test ! $(which brew); then
echo "Homebrew not found, Installing..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
Then i need to install some useful stuff as i see here:
http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
So i put this too on my script:
# Install GNU core utilities (those that come with OS X are outdated)
brew install coreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils
# Install Bash 4
brew install bash
# Install more recent versions of some OS X tools
brew tap homebrew/dupes
brew install homebrew/dupes/grep
$PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH
After that, the guide on the link says to install all the apps with cask and clean.
Here is my question.
I wish install and can update them in future using the classical Application folder of mac
How i can do that?
Maybe i should put this line:
export HOMEBREW_CASK_OPTS="--appdir=/Applications --caskroom=/usr/local/Caskroom"
Before all the commands to install the apps? May it works? (I have found this line here around)
If this line is correct can I update my apps using a brew/cask command?
Sorry for the dumbs questions, I've just discovered brew and cask yesterday :)
Any suggestion or example for this script is well accepted :)
brew cask install <formula> is supposed to symlink your app in Applications automatically.

Install Docker Toolbox on a Mac via command line

I am trying to automate setting up a developer environment on Mac. Part of that setup is installing the Docker Toolbox. I cannot find any documentation on how do to this via command line. How can I automate this installation (must be triggered via command line)?
Update: As pointed out in a commend by Dennis
Docker for Mac now exists, which is an alternative to Docker Toolbox. You can get it via the homebrew cask: brew cask install docker; open /Applications/Docker.app
Deprecation Warning
Docker Toolbox and Docker Machine have both been deprecated. Docker Desktop is the officially recommended replacement.
Original Answer
I found that Docker Toolbox is available via brew/cask
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Cask
brew install caskroom/cask/brew-cask
# Install docker toolbox
brew cask install docker-toolbox
Once Docker Toolbox is installed you can setup your docker environment using the Get started with Docker Machine guide.
# create the docker machine
docker-machine create --driver "virtualbox" myBoxName
# start the docker machine
docker-machine start myBoxName
# this command allows the docker commands to be used in the terminal
eval "$(docker-machine env myBoxName)"
# at this point can run any "docker" or "docker-compose" commands you want
docker-compose up
At the end of this process, add eval "$(docker-machine env myBoxName)" to your .bash_profile or you will get the following error when you open a new shell or terminal.
"Cannot connect to the Docker daemon. Is the docker daemon running on this host?"
If you start the docker container after opening the terminal, you can either run eval "$(docker-machine env myBoxName)" manually, or reload your bash profile (source ~/.bash_profile).
Docker Toolbox is a good option but currently it seems like Docker for Mac/Windows is becoming better and Docker is investing a lot of time polishing the app. I recommend installing Docker mainly for 2 reasons:
It doesn't interfere with Docker-Toolbox
It runs on HyperKit and therefor runs on you own localhost rather than a Docker Machine IP.
The installation is quite simple:
brew cask install docker
To install docker-toolbox you can refer the above post
Homebrew Updates
I can clear up a few things:
brew cask commands were deprecated on 2020-12-01 with the release of Homebrew 2.6.0. Starting then, all brew cask commands succeeded but displayed a warning informing users that the command would soon be disabled. The message also provides the appropriate replacement.
brew cask commands were disabled on 2020-12-21 with the release of Homebrew 2.7.0. Starting then, all brew cask commands failed and displayed a warning informing users that the command is disabled. The message also provides the appropriate replacement.
With the release of Homebrew 2.8.0 (release date TBD), this disable message will be removed.
The alternative to brew cask <command> is to use brew <command>. In many cases, you can add the --cask flag to specify casks only. For example, brew cask install atom is now brew install atom or brew install --cask atom. There are some casks that share a name with formulae (e.g. wireshark) so adding --cask ensures that the cask is installed not the formula.
I'm not much of an ansible user but I'm happy to try and help out if needed. Feel free to point me in the right direction if anything is blocked and could use feedback from the Homebrew side of things.
Now you can run like
brew install --cask docker

Getting Redis up an running with ruby

I have installed Redis via gems, but am having a problem getting it started.
Following James Edward Gary II steps http://blog.grayproductions.net/articles/setting_up_the_redis_server/
I have:
$ sudo gem install ezmobius-redis
Password:
Successfully installed ezmobius-redis-0.1
1 gem installed
Installing ri documentation for ezmobius-redis-0.1...
Installing RDoc documentation for ezmobius-redis-0.1...
$ redis-server path/to/redis.conf
-bash: redis-server: command not found
Any thoughts as to what I am missing?
If you have done just what you have described in your question, then you are missing redis. ezmobius-redis is just a Ruby library that allows connecting to redis. redis itself is a separate piece of software running independently.
If you followed the article you linked and if you especially did this:
curl -O http://redis.googlecode.com/files/redis-1.0.tar.gz
tar xzvf redis-1.0.tar.gz
cd redis-1.0
make
sudo cp redis-server redis-cli redis-benchmark /usr/local/bin
then you have actually installed a very old version of redis into the /usr/local directory.
If you did this starting the server did not work, then you probably have /usr/local not in your PATH. You can start the server using:
$ /usr/local/bin/redis-server path/to/redis.conf
However, I would suggest to install the newest version of redis. To do that on OSX you should use homebrew:
- Read this (https://github.com/mxcl/homebrew/wiki/Installation) as a guide on how to install homebrew and then do a
brew install redis
to install the newest version of redis.
You might need to open a new terminal to get the latest path settings. Try typing "bash" or "xterm &" and typing the redis-server command again.

Resources