Difference between revisions of "Compiling on macOS using Homebrew"

From GRASS-Wiki
Jump to: navigation, search
(Removed svn installation as it does not work anymore.)
m (Nila moved page Compiling on MacOSX using homebrew to Compiling on macOS using Homebrew: Update title to reflect new OS brand)
 
(5 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
This makes it perfect for the purpose of installing the master branch of GRASS GIS for testing purposes.
 
This makes it perfect for the purpose of installing the master branch of GRASS GIS for testing purposes.
  
== GRASS GIS 7.6+ ==
+
== GRASS GIS 7.8 and later ==
  
 
There is an [https://github.com/OSGeo/homebrew-osgeo4mac osgeo4mac] which contains [https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-grass.rb recipes for GRASS GIS 7.x] and other GIS tools - highly recommendable tap!
 
There is an [https://github.com/OSGeo/homebrew-osgeo4mac osgeo4mac] which contains [https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-grass.rb recipes for GRASS GIS 7.x] and other GIS tools - highly recommendable tap!
 +
 +
 +
'''Preparation:'''
 +
 +
To later get the GUI working, run
 +
 +
      pip3 install wxpython
  
 
'''Installation:'''
 
'''Installation:'''
Line 34: Line 41:
  
 
'''Testing:'''
 
'''Testing:'''
* by running (change '7x' to the current version)
+
* by running (change '7x' to the current version, e.g. 78)
       brew test -v grass-7x
+
       brew test -v grass-78
 
you can run GRASS GIS tests but they are not implemented as they should be - work in progress.
 
you can run GRASS GIS tests but they are not implemented as they should be - work in progress.
  
== GRASS GIS 7.2 ==
+
'''Starting it:'''
  
If you have a 3rd party Python installed, and/or Python 3, you need to remove it from your path for the installation. Once installed, GRASS will run even if the primary Python is, for example, Anaconda Python 3.
+
      grass78 --gui
  
Display the current path, and remove any folders or directories that provide access to the non-system python2.7:
+
== GRASS GIS 7.2 LTS ==
    echo $PATH
 
    #  ~/local/anaconda/bin:/Users/MyName/bin:/usr/local/bin:/usr/bin/sbin
 
Reset path
 
    PATH=/usr/local/bin:/usr/bin/sbin
 
Set GRASS python
 
    export GRASS_PYTHON=/System/Library/Frameworks/Python.framework/Versions/Current/bin/pythonw
 
  
Install packages with Brew
+
OSGEO4mac has also a formalar to install the GRASS GIS 7 LTS.
    brew tap osgeo/osgeo4mac
 
    brew install netcdf
 
    brew install gdal2 --with-complete --with-unsupported
 
    export GDAL_DATA=/usr/local/opt/gdal2/share/gdal/ 
 
    # Also add the above line to ~/.bash_profile, ~/.bashrc, or some other login script
 
    brew install grass7 --with-netcdf
 
    brew install gdal2-grass7
 
  
Notes:
+
Follow the procedure as described in section '''GRASS GIS 7.6+''' but use
# PATH adjustments are only needed during installation. After installation, the PATH can return to its default value and GRASS works fine.
 
# There may be other brew dependencies that were installed previously and therefore not listed here.
 
  
 +
    brew install grass7-lts
  
 
== GRASS GIS 7.0.x for El Capitan without disabling SIP ==
 
== GRASS GIS 7.0.x for El Capitan without disabling SIP ==

Latest revision as of 03:16, 5 June 2020

What is homebrew and why use it

To quote from their website:

Homebrew is the missing package manager for OS X:

  • easy to install
  • does not need administrator privileges
  • installs packages to their own directory and then symlinks their files into /usr/local

For further information to install it and how to use it, see the Homebrew website and the Wiki.

The formulas to install programs are called recipes and they make it possible to install several version of the same program (as well as HEAD of different Version Control Systems) at the same time which can then be symlinked. This makes it perfect for the purpose of installing the master branch of GRASS GIS for testing purposes.

GRASS GIS 7.8 and later

There is an osgeo4mac which contains recipes for GRASS GIS 7.x and other GIS tools - highly recommendable tap!


Preparation:

To later get the GUI working, run

     pip3 install wxpython

Installation:

Just run

     brew tap osgeo/osgeo4mac

and then

     brew install osgeo-grass

Easy, isn't it?

You can also install via URL:

     brew install https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-grass.rb

Testing:

  • by running (change '7x' to the current version, e.g. 78)
     brew test -v grass-78

you can run GRASS GIS tests but they are not implemented as they should be - work in progress.

Starting it:

     grass78 --gui

GRASS GIS 7.2 LTS

OSGEO4mac has also a formalar to install the GRASS GIS 7 LTS.

Follow the procedure as described in section GRASS GIS 7.6+ but use

   brew install grass7-lts

GRASS GIS 7.0.x for El Capitan without disabling SIP

The new homebrew recipe for GRASS 7.0 does install on El Capitan with SIP enabled! This is thanks to Larry Shaffer. See https://github.com/OSGeo/homebrew-osgeo4mac/issues/118#issuecomment-200278686

The recipe is part of the Homebrew-osgeo4mac tap, see

https://github.com/OSGeo/homebrew-osgeo4mac

for info on how to use them.