MacOSX GRASS errors: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(hint for "image not found" error)
m (updating issues and solutions)
 
(13 intermediate revisions by 3 users not shown)
Line 3: Line 3:
== Starting GRASS GIS on MacOSX, I get "image not found" ==
== Starting GRASS GIS on MacOSX, I get "image not found" ==


You are lacking the installation of one or several "frameworks" (e.g. GDAL). Get them from here:
A) You may be lacking the installation of one or several "frameworks" (e.g. GDAL). Get them from here:


  http://grass.osgeo.org/download/software/mac-osx/
  http://grass.osgeo.org/download/software/mac-osx/
  --> Install the required framework packages first
  --> Install the required framework packages first
This is not needed for binaries created for versions 7.2.2 and higher on the [http://grassmac.wikidot.com GRASS for Mac site] because all dependencies, including Python and wxPython are included in the binary app.
B) You are hit by the SIP - System Integrity Protection - security measure which prevents some software from being installed properly. Please see the internet for suggestions how to deal with that. Alternative: use "[[Compiling on MacOSX using homebrew|homebrew]]" to install GRASS GIS. This is no longer a problem in binaries created for versions 7.2.2 and higher on the [http://grassmac.wikidot.com GRASS for Mac site] because all dependencies, including Python and wxPython are included in the binary app.


== Starting GRASS GIS on MacOSX, I get "bad cpu type in executable" ==
== Starting GRASS GIS on MacOSX, I get "bad cpu type in executable" ==
Line 15: Line 19:
  export GRASS_PYTHON=/usr/bin/python2.6
  export GRASS_PYTHON=/usr/bin/python2.6
  export GRASS_PYTHONWX=/usr/bin/pythonw2.6
  export GRASS_PYTHONWX=/usr/bin/pythonw2.6
The newest versions of GRASS 7.8.2 and up) are designed to work with Python 3. So you may want to install Python 3 and change the path for GRASS_PYTHON and GRASS_PYTHONWX accordingly
This is not a problem for binaries created for versions 7.2.2 and higher on the [http://grassmac.wikidot.com GRASS for Mac site] because all dependencies, including Python and wxPython are included in the binary app.


== When using g.extension, I get "fatal error: grass/gis.h: No such file or directory" ==
== When using g.extension, I get "fatal error: grass/gis.h: No such file or directory" ==


A: tbd
Hint: g.extension should indeed work. The main key is that you need to install the Xcode command line tools.  This can be done either from the Xcode app (free from app store), or by downloading the command line tools installer separately (from an Apple developer account).
 
== When using g.extension after updating to MacOSX Mojave and Xcode 10, I get "fatal error: 'stdio.h' file not found" ==
 
Note: Updating to MacOSX Mojave and Xcode 10 moves the location of the c header files preventing some GRASS extensions from compiling.
 
Solution: Install the package file located at the below path to add c header files in /usr/include:
 
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
 
 
'''Update'''
 
Fix this issue by updating ''/Applications/GRASS-7.6.app/Contents/Resources/include/Make/Platform.make''
 
By replacing all references to /Developer/SDKs/MacOSX10.9.sdk with the updated sdk path /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
 
'''Variables to Update'''
 
CFLAGS              = -g -O2  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS            =  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
INCLUDE_DIRS        =  -I/Applications/GRASS-7.6.app/Contents/Resources/include
LINK_FLAGS          =  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/Applications/GRASS-7.6.app/Contents/Resources/lib -Xlinker -rpath -Xlinker ${prefix}/lib -Xlinker -rpath -Xlinker ${RUN_GISBASE}/lib
 
MACOSX_SDK          = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
 
== Starting GRASS GIS on MacOSX, I get "AppleScript Error. Terminal got an error: Can't get window 1. (-1728)" ==
 
Note: Normally when Terminal is activated (running or not), it starts a new window if there is none open, but I've seen cases where it does not when you start Terminal when it was NOT running.
 
Solution: Try starting Terminal first, then start GRASS.
 
Note that it may still take a long time to launch the terminal and GRASS sometimes, for unknown reasons, especially for the first time after a new installation or update. Be patient.
 
== Starting GRASS GIS on MacOSX, I get "ERROR: unknown locale: UTF-8" ==
 
You need to add these two lines
 
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
 
to the file ".bash_profile" in your HOME directory. You can use any text editor to create/edit the file $HOME/.bash_profile (the same: ~/.bash_profile) and copy-paste the these two lines. Just be sure to save it as ".bash_profile" in your home directory.
 
== d.legend does not show numbers ==
 
Problem: d.legend and other text is not shown in the display!
 
Solution: You need to rescan the fonts available on your system:
 
  g.mkfontcap -o
 
 
== 3D view error on MacOS (black screen) ==
 
Problem: 3D view error on MacOS (black screen)


Hint: g.extension should work.  The main key is that you need to install the Xcode command line tools.  This can be done either from the Xcode app (free from app store), or by downloading the command line tools installer separately (from an Apple developer account).
Solution: compile GRASS GIS using [[Compiling on MacOSX using homebrew|homebrew]] libraries. The trick was to set --with-opengl=aqua, so it uses the opengl librarie from the system. Using --with-opengl=x11 results in the black screen.


== See also ==
== See also ==


* MacOSX GRASS Support forum: http://grassmac.wikidot.com/forum:start
* http://www.kyngchaos.com/software/support/faq
* http://www.kyngchaos.com/software/support/faq
* [[WinGRASS errors]]
* [[WinGRASS errors]]

Latest revision as of 23:03, 23 April 2020

Here some problems reported by users along with solutions:

Starting GRASS GIS on MacOSX, I get "image not found"

A) You may be lacking the installation of one or several "frameworks" (e.g. GDAL). Get them from here:

http://grass.osgeo.org/download/software/mac-osx/
--> Install the required framework packages first

This is not needed for binaries created for versions 7.2.2 and higher on the GRASS for Mac site because all dependencies, including Python and wxPython are included in the binary app.

B) You are hit by the SIP - System Integrity Protection - security measure which prevents some software from being installed properly. Please see the internet for suggestions how to deal with that. Alternative: use "homebrew" to install GRASS GIS. This is no longer a problem in binaries created for versions 7.2.2 and higher on the GRASS for Mac site because all dependencies, including Python and wxPython are included in the binary app.

Starting GRASS GIS on MacOSX, I get "bad cpu type in executable"

It looks like a macports problem (maybe homebrew also uses /opt/local?) with their Python. A guess is that their python is 64bit-only, and GRASS is trying to run python 32bit because it couldn't find a 64bit wxpython because 64bit wxpython isn't existing yet in the stable release.
Work-around: Edit the file ".bash_profile" in your HOME directory and add therein:

export GRASS_PYTHON=/usr/bin/python2.6
export GRASS_PYTHONWX=/usr/bin/pythonw2.6

The newest versions of GRASS 7.8.2 and up) are designed to work with Python 3. So you may want to install Python 3 and change the path for GRASS_PYTHON and GRASS_PYTHONWX accordingly

This is not a problem for binaries created for versions 7.2.2 and higher on the GRASS for Mac site because all dependencies, including Python and wxPython are included in the binary app.

When using g.extension, I get "fatal error: grass/gis.h: No such file or directory"

Hint: g.extension should indeed work. The main key is that you need to install the Xcode command line tools. This can be done either from the Xcode app (free from app store), or by downloading the command line tools installer separately (from an Apple developer account).

When using g.extension after updating to MacOSX Mojave and Xcode 10, I get "fatal error: 'stdio.h' file not found"

Note: Updating to MacOSX Mojave and Xcode 10 moves the location of the c header files preventing some GRASS extensions from compiling.

Solution: Install the package file located at the below path to add c header files in /usr/include:

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg


Update

Fix this issue by updating /Applications/GRASS-7.6.app/Contents/Resources/include/Make/Platform.make

By replacing all references to /Developer/SDKs/MacOSX10.9.sdk with the updated sdk path /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Variables to Update

CFLAGS              = -g -O2   -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS            =   -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
INCLUDE_DIRS        =  -I/Applications/GRASS-7.6.app/Contents/Resources/include
LINK_FLAGS          =   -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/Applications/GRASS-7.6.app/Contents/Resources/lib -Xlinker -rpath -Xlinker ${prefix}/lib -Xlinker -rpath -Xlinker ${RUN_GISBASE}/lib
MACOSX_SDK          = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Starting GRASS GIS on MacOSX, I get "AppleScript Error. Terminal got an error: Can't get window 1. (-1728)"

Note: Normally when Terminal is activated (running or not), it starts a new window if there is none open, but I've seen cases where it does not when you start Terminal when it was NOT running.

Solution: Try starting Terminal first, then start GRASS.

Note that it may still take a long time to launch the terminal and GRASS sometimes, for unknown reasons, especially for the first time after a new installation or update. Be patient.

Starting GRASS GIS on MacOSX, I get "ERROR: unknown locale: UTF-8"

You need to add these two lines

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

to the file ".bash_profile" in your HOME directory. You can use any text editor to create/edit the file $HOME/.bash_profile (the same: ~/.bash_profile) and copy-paste the these two lines. Just be sure to save it as ".bash_profile" in your home directory.

d.legend does not show numbers

Problem: d.legend and other text is not shown in the display!

Solution: You need to rescan the fonts available on your system:

 g.mkfontcap -o


3D view error on MacOS (black screen)

Problem: 3D view error on MacOS (black screen)

Solution: compile GRASS GIS using homebrew libraries. The trick was to set --with-opengl=aqua, so it uses the opengl librarie from the system. Using --with-opengl=x11 results in the black screen.

See also