Install Git before Boxen, or Boxen before Git? - macos

So, I've just ponied up for a Mac, and I'm looking to use Boxen to get a working environment setup. Thing is, the setup instructions are a little confusing. The intro on this page:
https://github.com/boxen/our-boxen#getting-started
uses git
sudo mkdir -p /opt/boxen
sudo chown ${USER}:admin /opt/boxen
git clone <location of my new git repository> /opt/boxen/repo
cd /opt/boxen/repo
script/boxen
but it then goes on to state:
This template project provides the following by default:
Homebrew
Git
Hub
I get the impression that you ideally want to have a clean system to avoid conflicts when using Boxen, so before I get git from homebrew/app store, I wanted to see how others have gone about setting up Boxen so I can save myself some headaches

I don't think you need to install git first. I've installed Boxen, although I haven't yet tried a clean bootstrap on a new machine. Here's my understanding:
1) The X-Code Command-Line tools are a prerequisite for installing Boxen - X-Code installs a version of git as /usr/bin/git, so there is no need to explicitly install another git to bootstrap Boxen. On my machine - Mountain Lion/10.8.3:
$ /usr/bin/git --version
git version 1.7.12.4 (Apple Git-37)
2) Once you install Boxen, Boxen will then install the Homebrew release of git at /opt/boxen/homebrew/bin/git, which is likely a newer version of the X-Code Command-Line git:
$ /opt/boxen/homebrew/bin/git --version
git version 1.8.0
3) Finally, by default, Boxen will install hub, which will alias git to hub (hub is a GitHub-enhancing wrapper around git):
$ type -a git
git is aliased to `hub'
git is /opt/boxen/homebrew/bin/git
git is /usr/bin/git
$ git --version
git version 1.8.0
hub version 1.10.5

I let Xcode command line tools do it for me, before I setup a fresh Boxen:
$ xcode-select --install
After you setup your Boxen, you'll be up to the appropriate Git version.

Related

Can I install/use git on OS X Yosemite without CLDT?

A friend of mine need to clone a git repo, but on his machine is xcode not installed and when he tries to use git his Macbook says
The command git requires the command line developer tools, do you want to install them?
The picture is in German.
So is it possible to use git on OS X without Xcode?
Yes. Instead of using the built-in git command:
Install Homebrew if you haven't already:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run brew update && brew install git
Restart Terminal (or close the current tab and open a new one)
Before you do this:
$ git --version
git version 1.9.3 (Apple Git-50)
After you do this:
$ git --version
git version 2.2.1
How about using SourceTree.app?
http://www.sourcetreeapp.com/
SourceTree.app has also git binary.
$ SourceTree.app/Contents/Resources/git_local/bin/git --version
git version 2.2.1
EDIT
he has github for mac installed and git, but it shows this message anyway :(
I guess he didn't set PATH env, so that git was /usr/bin/git. He should use /Applications/GitHub.app/Contents/Resources/git/bin/git instead of git, or set PATH env.

Different versions of Git on Mac OS Yosemite

I guess Git on my macbook was of version 1.8.4, because I tried
git --version
git version 1.8.4
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
whereis git
/usr/bin/git
later I try to upgrade the latest version of Git to 2.0.1, I download and install from
http://git-scm.com/download/mac
Since this installer installs Git to /usr/local/git, and append the path to $PATH, so now
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
I also replace the binary file to /usr/bin/ by
sudo cp /usr/local/git/bin/git /usr/bin/
And I logged out and logged in back, but found the following strange situation:
/usr/bin/git --version
git version 2.0.1
git --version
git version 1.8.4
whereis git
/usr/bin/git
Where does my mac os look for when I type git --version? Where is my previous version 1.8.4 located and how can I delete it and replace it with my new version?
The correct way to use another version of git would be to put it first in the path. Edit the file that appends /usr/local/git/bin to the path so that it prepends it instead.
Most likely there is something like the following in either your ~/.bash_profile or ~/.profile.
export PATH="$PATH:/usr/local/git/bin"
Change it to:
export PATH="/usr/local/git/bin:$PATH"
BTW, sudo cp /usr/local/git/bin/git /usr/bin/ is probably not a good idea, as other software may expect the default version to be there. A software update may also replace it.

Cannot install via Homebrew nor Git installer

I'm on Mac 10.9.4.
I have Git version 1.8.5.2.
I want to upgrade to latest stable verson of Git (2.0.1 or 2.1?)
I don't know how Git initially was installed on my computer.
When I try with Homebrew I get the following message: "Error: git not installed".
When trying to run uninstall.sh from the official Git installer (appearantly I have to uninstall) I get the following message: "Git doesn't appear to be installed via this installer. Aborting"
The git you have the pre-installed osx git.
Notice that when you run 'git --version' you get: 'git version 1.9.3 (Apple Git-50)'.
You can just run the git installer...
brew install git
$ git --version
git version 1.7.12.4 (Apple Git-37)
$ which git
/usr/bin/git
// doh! osx's pre-installed git trumps the brew one, so:
$ sudo mv /usr/bin/git /usr/bin/git-apple
--RUN THE GIT INSTALLER
$ which git
/usr/local/bin/git
$ git --version
git version 1.8.2
// ok cool.

git version and brew upgrade on different versions, no xcode, need fix

which git
gives me: /usr/bin/git
git --version
gives me: git version 1.8.5.2 (Apple Git-48)
brew upgrade git
gives me: Error: git-1.9.0 already installed
So I ask: What's up? and How do I fix it?
This is because you are using version of git that was installed not by brew. Brew stores its git install in the path /usr/local/bin/git You must remove the git that was not installed by brew, or change the order of your $PATHS to check /usr/local/(bin|sbin) first.

Command-line SVN client for Mac

I purchased a new Mac running Mac OS X v10.8.5 (Mountain Lion). I've seen it written in various places that SVN is installed on OS X by default, but when I open a terminal and type which svn the program is not found. I've also run find / -name svn to check if it's installed somewhere that hasn't been added the the PATH variable.
So it seems like svn is not installed. Where can I get an OS X version of the official command-line SVN client?
The default SVN version which is installed along with Xcode command line tools is 1.7.x. If you're fine with this version, than that should be enough. I want to select my SVN version and for that I'm using Homebrew.
Install Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install SVN:
brew install svn
To install a specific SVN version, check available versions:
brew versions svn
This command will list all available SVN versions.
Here's how you can install other than the default version (based on this gist)
# Update brew
brew update
# Switch to brew base directory
cd $( brew --prefix )
# Check old versions
brew versions svn
# Here's sample output
1.8.9 git checkout 9b75c92 /usr/local/Library/Formula/subversion.rb
1.8.8 git checkout c6cf8ac /usr/local/Library/Formula/subversion.rb
1.8.5 git checkout fa4311c /usr/local/Library/Formula/subversion.rb
1.8.4 git checkout ce669eb /usr/local/Library/Formula/subversion.rb
1.8.3 git checkout 9b438ce /usr/local/Library/Formula/subversion.rb
1.8.0 git checkout f56b641 /usr/local/Library/Formula/subversion.rb
1.8.1 git checkout 55577bb /usr/local/Library/Formula/subversion.rb
1.7.10 git checkout 0060dc3 /usr/local/Library/Formula/subversion.rb
1.7.9 git checkout b0e6223 /usr/local/Library/Formula/subversion.rb
1.7.8 git checkout f7a42d2 /usr/local/Library/Formula/subversion.rb
1.7.7 git checkout a6dcc41 /usr/local/Library/Formula/subversion.rb
1.7.6 git checkout 6b8d25f /usr/local/Library/Formula/subversion.rb
1.7.5 git checkout 5d5cd70 /usr/local/Library/Formula/subversion.rb
1.7.4 git checkout dc4245c /usr/local/Library/Formula/subversion.rb
1.7.3 git checkout eb97154 /usr/local/Library/Formula/subversion.rb
1.7.2 git checkout d89bf83 /usr/local/Library/Formula/subversion.rb
1.6.17 git checkout 6e2d550 /usr/local/Library/Formula/subversion.rb
1.6.16 git checkout 83ed494 /usr/local/Library/Formula/subversion.rb
# Install SVN version 1.6.17. You can just copy line from output
git checkout 6e2d550 /usr/local/Library/Formula/subversion.rb
brew install subversion
# Switch to SVN version 1.6
brew switch subversion 1.6.17
Now that the older SVN version is installed, we can re-install the latest formula in order to keep our repository clean:
git checkout -- Library/Formula/subversion.rb
Now you can switch between versions using svn switch command.
Make sure that brew's executables are first in your environment path. Check in your .bash_profile that path is set as follows:
export PATH=/usr/local/bin:${PATH}
For me, it just worked with brew on MacOS version 10.15.4
COMMAND:- brew install svn
That is all, you will have an svn command-line client installed.
Happy Coding!
If you have HomeBrew installed,
try this command: brew install subversion
after that, brew link subversion
Hopefully, you will be good to go.
Subversion itself is no longer included with OS X. It's now included as part of Xcode. So one option is to install Xcode and then install the Command Line Tools. If you're not going to install Xcode anyway then you may be better off downloading a different installation of Subversion. On top of that the Xcode version is usually fairly behind on releases now.
So I'd suggest getting it from one of the sources on the Subversion Projects Binaries Page.
You can get SVN with Xcode, Homebrew, MacPorts, and probably other sources as well. The latter two options will probably stay more up to date than Xcode's installation.
Xcode's command line tools can be downloaded from here: https://developer.apple.com/downloads/index.action#
April 2014 version direct download link:
https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mavericks_for_xcode__april_2014/command_line_tools_for_osx_mavericks_april_2014.dmg
For newer users or Mojave OS users:
I am using my MAC running Mojave OS. It seems that Apple fixed Mojave and updated OS so that SVN is added back again (it was not by default when Mojave was out). To check if you have SVN installed simple run terminal (command+space than type 'terminal' and press enter).
In terminal type :
svn --version
or:
svn help
If you don't see "unknown command", you have SVN installed already. Otherwise try updating Mojave OS in case you avoid auto updates.

Resources