Best place to download Git for 2023 MacBook Pro, Homebrew or MacPorts?

I am new to coding and I am taking a course that requires me to download Git through either Homebrew or MacPorts. What is the best option? Thx!

MacBook Pro 14″, macOS 13.5

Posted on Oct 22, 2023 7:47 AM

Reply
6 replies

Oct 22, 2023 9:40 AM in response to volleymom11

Apple's Command Line Tools for Xcode will install Git along with compilers and libraries. In the Terminal application:


sudo xcode-select --install


When the Command Line Tools are finally installed, you can find git at /usr/bin/git. This will be an older version than provided by homebrew or macports, and homebrew would automatically install the Command Line Tools as one of its own installation dependencies (unless they are already installed) as it must compile any packages you request.


Homebrew on an M1 or M2 Mac will want to install into /opt/homebrew rather than /usr/local/homebrew on Intel Macs. That will require you to add the following to your SHEL dotfile path if you want to access a homebrew git installation before the one in /usr/bin:


export PATH=".:/opt/homebrew/bin:${PATH}"


Some are reporting that homebrew is now messing up their Shell dotfile contents with other unnecessary junk that interferes with Shell behavior. Mine didn't but I haven't installed homebrew in quite awhile. I am using an M2 mini Pro with Somoma 14.0.


Here is the homebrew dependency graph for git:



and a SHELL alias (that does not install any packages):


alias brew_deps='brew deps --tree --installed "$@"'



Oct 22, 2023 5:16 PM in response to volleymom11

Git is a source control software. It allows you to track your changes. So, for example, when you get one particular part of a project working, you commit your changes. Then you try the next step. This time, you royally screw it up and your code is worthless. Just reset your repository and you are back to where you were before you scrambled it. This is practically every day of my life.


All you need to do is try to run "git" on the command line. You don't need to download anything first. Once you attempt that command, you'll see a popup asking if you want to download the Xcode Command Line tools. You do. Once that completes, you'll be able to run git.


I don't recommend that you download either MacPorts or Homebrew. I regularly see people who've installed those tools and had them totally scramble their command line environment. Don't go there.


For your class, you should use the tools dictated by the course. However, for HTML, CSS, and JS, you don't really need any of that. You can do it all in the Terminal using "vi". If you want to be fancy, you can download the BBEdit text editor. But stick with the course tools for now. Once you get each project working, then try using BBEdit and start to explore on your own. You might even want to try downloading Xcode and using that as an IDE instead of VisualStudio Code. I build all my websites in Xcode. If you want to download Xcode, just remember to download it directly from the Apple Developer site. Do NOT attempt to download it from the Mac App Store. It's a long story that you don't want to deal with.



Oct 22, 2023 10:48 AM in response to volleymom11

I have used MacPorts mainly to install ffmpeg and some related apps. MacPorts installs git at:


/opt/local/bin/git


port installed

The following ports are currently installed:

[...]

git @2.38.1_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34

git @2.39.0_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34

git @2.39.1_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34

git @2.39.2_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34

git @2.40.0_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34

git @2.41.0_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34

git @2.42.0_0+credential_osxkeychain+diff_highlight+doc+pcre+perl5_34 (active)


Oct 22, 2023 11:45 AM in response to volleymom11

Of the two choices, I mostly use Homebrew. Both Homebrew and MacPorts have issues.


For git, I use the Apple client-line provided by Xcode while at the command line as was mentioned by VikingOSX, and use the Xcode git integration when using that IDE.


There are free and paid GUI (and terminal graphics, in the case of GitUI) clients available, as well:


https://catalins.tech/best-git-clients-mac/


More generally, is this programming class targeting the command line for programming, or any particular IDEs?


Which programming language will you be learning?


I'm mildly surprised the class is sending you off to the command line, is sending you after Git, and that the instructor is not making more specific recommendations, as there are seemingly always tooling and setup issues somewhere, and many class instructors will provide suggestions intended to reduce the app and tool permutations that they have to field questions for.


Most recent IDEs such as Xcode will have Git support built in. If you're planning to learn Swift here, the Swift Playgrounds IDE is more limited in its source code control support, but can access Swift Packages located on Github.

Oct 22, 2023 5:04 PM in response to MrHoffman

The class is a beginner class on JavaScript. It's an online course via a pre-recorded video. He showed us where to go to download Git and said there are options for Windows and Mac but he didn't mention the options available within the Mac downloads (does that make sense?) so when I clicked the Mac link to download I wasn't sure which to choose.

I already have VisualStudio Code and Brackets. Not sure if I need Git, but all of the technical terms are pretty new to me so I'm not sure how to proceed. Basically, I won't be using Git for anything but basic coding (HTML, CSS, and JS) for the time being.

Oct 22, 2023 5:46 PM in response to volleymom11

VSC integrates with git, so having VSC means you have git. (But now you need to learn that part of VSC.)


https://code.visualstudio.com/docs/sourcecontrol/overview


But as mentioned in various replies, use whatever tools the class is using, as you’re otherwise potentially headed for some frustration.


And this JavaScript class might be a little further along too, if you’re just learning to program. If you’re just learning about programming, there are various cheap and free intro classes available, including a (free) Python class at Harvard:


https://cs50.harvard.edu/python/2022/


That class is described as “An introduction to programming using a language called Python. Learn how to read and write code as well as how to test and “debug” it. Designed for students with or without prior programming experience who’d like to learn Python specifically.”


Apple prefers people use Swift (which starts out simple, and gets… sophisticated), and Apple has some materials and tools for learning about that. Using Playgrounds and its Swift tutorials for instance, and probably not Xcode: Swift Playgrounds - Apple Developer


Here are a couple of earlier threads with folks looking to learn about programming:

how to learn Swift - Apple Community

I'm just starting out coding/programming - Apple Community


There’s no one right way to learn programming, and learning really never stops as the arrival of new products and new updates and churn just never ceases.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Best place to download Git for 2023 MacBook Pro, Homebrew or MacPorts?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.