[GRASS-dev] GRASS GIS for Apple Silicon Macs

Edouard Choinière e.chs at outlook.com
Fri Sep 22 10:33:54 PDT 2023


I think I figured out an explanation. I tried to read about CI for macOS, then on why there aren’t a lot of CI for macOS (especially Apple Silicon). I also couldn’t look into the build infrastructure used for your grass macOS builds since they don’t seem to be available on GitHub. Is it local only?

Ok, so now to a possible explanation on why Rosetta 2 is asked to be installed.
It seems that with Apple Silicon, arm64 code needs to be signed (which is new), while x86_64 doesn’t, like before. I think it was mentioned in the thread that the app might be unsigned. So I suspect that even if a universal binary contains arm64 and x86_64 binaries, if it is unable to use the arm64 binary, it will try using the intel ones.


<https://www.sentinelone.com/blog/why-your-macos-edr-solution-shouldnt-be-running-under-rosetta-2/>
[Apple-Silicon-Rosetta-2-and-the-Challenges-for-Endpoint-Security-7.jpg]
Why Your macOS EDR Solution Shouldn't Be Running Under Rosetta 2<https://www.sentinelone.com/blog/why-your-macos-edr-solution-shouldnt-be-running-under-rosetta-2/>
sentinelone.com<https://www.sentinelone.com/blog/why-your-macos-edr-solution-shouldnt-be-running-under-rosetta-2/>

In particular, see the part where it says:


That’s because one of the changes Apple brought in with Big Sur<https://www.sentinelone.com/blog/macos-big-sur-has-landed-10-essential-security-tips-you-should-know/> that only applies to Apple silicon Macs is that native arm64 code cannot execute on an M1 Mac unless it has a valid code signature.

An Apple silicon Mac doesn’t permit native arm64 code execution under any conditions unless a valid signature is attached. Translated x86_64 code, however, is not subject to this restriction<https://support.apple.com/guide/security/rosetta-2-on-a-mac-with-apple-silicon-secebb113be1/web>: translated x86_64 code is permitted to execute through Rosetta with no signature information at all.



There’s also that thread that was linked to from my reading some Reddit threads (like https://www.reddit.com/r/programming/comments/15njgdc/apple_doesnt_want_you_developing_hobby_apps/jvmvxv6/<https://www.reddit.com/r/programming/comments/15njgdc/apple_doesnt_want_you_developing_hobby_apps/jvmvxv6/?utm_source=share&utm_medium=mweb3x&utm_name=mweb3xcss&utm_term=1&utm_content=share_button>, was useful if you ignore the purely Reddit-like comments)

<https://github.com/Homebrew/brew/issues/9082>
[9082.png]
Codesigning on macOS 11 on Apple Silicon · Issue #9082 · Homebrew/brew<https://github.com/Homebrew/brew/issues/9082>
github.com<https://github.com/Homebrew/brew/issues/9082>

These two sources also point to a potential problem with “ad hoc” signing that would have a “works on my machine” effect, if the executable changes somewhere. But the debugging done doesn’t indicate that this is what is happening now from the messages received.


I don’t own a macOS computer, nor a macOS computer with Apple Silicon in order to do any of the debugging needed to confirm all of this.


Edouard Choinière

Le 22 sept. 2023 à 05:01, Nicklas Larsson via grass-dev <grass-dev at lists.osgeo.org> a écrit :

Gregor, thanks very much for the info! At least it ruled some things out, but I have still no idea what is causing this and it’s very difficult do the needed poking around without a similar setup (macOS 14 without Rosetta installed). I’ll have to ponder on this, if this really is caused by some change by macOS 14, a solution must be found sooner rather than later.

An alternative way to install GRASS with native architecture for ARM is with MacPorts [1]. It does, however, involve some Terminal-batics! If you are in need for other GIS software like QGIS in particular, MacPorts is currently, in my experience, a most solid solution with available GRASS plugin (as there is no native official QGIS.app bundle for ARM).

To be continued…

Cheers,
Nicklas

[1] https://grasswiki.osgeo.org/wiki/Compiling_on_macOS_using_MacPorts


On 20 Sep 2023, at 16:47, Gregor Hintner <gregorhintner at icloud.com> wrote:

Niklas,


please find my answers below:

`file /usr/bin/osascript`

evidently still a universal binary, see this screenshot
<Screenshot 2023-09-20 at 4.13.56?PM.png>

`osascript -i`

worked with no noticeable issues

/Applications/GRASS-8.3.app/Contents/MacOS/Grass.sh

produced the unverified developer warning as expected. Logically I could and should probably override this, but with 10 years since my last time coding, and having never learned the basics of UNIX, I would prefer to follow the strictest Apple security guidelines, or sometimes perhaps theater, when possible.
<Screenshot 2023-09-20 at 4.21.07?PM.png>

`sw_vers -productVersion`
14.0
<Screenshot 2023-09-20 at 4.33.25?PM.png>

file /usr/bin/sw_vers
universal binary
<Screenshot 2023-09-20 at 4.31.23?PM.png>


Hope this helps,
Gregor


On 2023-09-20, at 9:52 AM, Nicklas Larsson <n_larsson at yahoo.com> wrote:

Gregor,

Browsing the content of both GRASS.app and the FreeCAD.app, they seem correctly to have been built for arm machines. Both are based on conda dependencies and both are initiated by shell script.

The shell script initialising GRASS involves the use of '/usr/bin/osascript', which on macOS 12 is a universal binary. Perhaps something did change with this command, please test the following:

`file /usr/bin/osascript`

and

`osascript -i`

(which should enter interactive mode, you may exit with Ctrl-C).


You could also try start GRASS manually from Terminal:

`/Applications/GRASS-8.3.app/Contents/MacOS/Grass.sh`

(That step may, however, be prevented because of the app being unsigned).



For control, the FreeCAD shell script contains the following command:

`sw_vers -productVersion`

Could you try that? ’sw_vers' is also a universal binary on macOS 12. What will the following give:

`file /usr/bin/sw_vers`


Best,
Nicklas




On 19 Sep 2023, at 20:54, Michael Barton <Michael.Barton at asu.edu> wrote:

I've been corresponding with this GRASS user about how the software works with the new Apple ARM processors. Nicklas and I have compiled GRASS for ARM processors successfully. These are posted on the GRASS for Mac site (https://cmbarton.github.io/grass-mac/). When Gregor tries to launch GRASS under the new MacOS 14 (Sonoma) he gets a notice that Rosetta (Intel processor emulator) is needed. They launch on my ARM MacBook Pro with no notice, but I am not using Sonoma yet.

Does anyone have any suggestions about what might be triggering this notice at launch time? AFAIK, initialization only calls the following:
1. shell launch script
2. wxPython
3. Python

Is there any other module or dependency that gets called at initial launch (no maps displayed)?

Michael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


Begin forwarded message:

From: Gregor Hintner <gregorhintner at icloud.com>
Subject: Re: GRASS GIS for Apple Silicon Macs
Date: September 18, 2023 at 11:34:02 AM MST
To: Michael Barton <Michael.Barton at asu.edu>

Unfortunately I suspect we have had another miscommunication.
Let me list the specific steps that lead to the Rosetta prompt:
- Download GRASS 8.3.0 Apple ARM or GRASS 8.4dev from your webpage
- mount either downloaded Diskimage
- copy the GRASS application file from the mounted DMG to the Applications folder
- double click and launch the GRASS application
- macOS shows a prompt to install Rosetta to continue

Obviously the prompt only appears when actually launching GRASS, the launch just never progresses past it, and no console or GUI can appear.

To my eyes the OS behavior seems credible in this case, though I obviously have no insights beyond the regular UI level.

Could you send me an email contact to the GRASS dev list. I frankly never understood how these lists work, I assume some kind of e-mail chain, but I noticed no actual e-mail addresses on the main GRASS webpage, only on your Mac distribution site.


Thanks,
Gregor


On 2023-09-18, at 8:20 PM, Michael Barton <Michael.Barton at asu.edu> wrote:

 Gregor,

I lean toward this being a bug in the beta at the moment. The reason is that installing GRASS should not raise a Rosetta request, at least until you run GRASS. This is because GRASS is organized as a set of independent modules, overlayed with an optional GUI. Running GRASS invokes a shell script (that should not require Rosestta, since it launches an ARM terminal) and than the GUI in Python 3 and wxPython. But these should also be ARM compatible. It is possible that one or more of the >300 individual modules or dependencies require Rosetta. But these should not call Rosetta until they are launched. Also, they are mostly in C and Python, with some C++ code--all of which was compiled under ARM tools. You might post this question to the GRASS dev list. It is hard to say what is causing this message to appear in your beta when nothing is launched.

Michael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 17, 2023, at 8:02 PM, Gregor Hintner <gregorhintner at icloud.com> wrote:

Understood!
If possible, and if you deem it worth it, I would kindly ask you to eventually address this presumed issue.
Apple Silicon Mac users like myself will probably avoid to install the Rosetta framework also in the future, as more and more apps get native releases.
Obviously, as you offer your work voluntarily and for free, I have no way to make demands, I simply submit the suggestion for your consideration.

Furthermore I would truly hope for someone to develop a lightweight iPadOS map authoring app in the future, as foremost the interface, paired with Apple Pencil, just fits graphics and geometry oriented work very naturally, and I personally see the entire system architecture as much more pleasant and intuitive. Lastly I would really hope that land survey work can escape the ruthless grip of proprietary software platforms like the Autodesk apps.


Kind regards,
Gregor


On 2023-09-18, at 4:19 AM, Michael Barton <Michael.Barton at asu.edu> wrote:

 Thanks for the information. This is helpful. It is possible that a dependency somewhere in the app needs Rosetta. However, the app is compiled with the ARM SDK and an ARM build environment.

Michael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 17, 2023, at 7:15 PM, Gregor Hintner <gregorhintner at icloud.com> wrote:

I use an M2 MacBook Air purchased from Apple.com, running Sonoma Beta.
The machine shipped with Rosetta excluded from the macOS installation as standard.
For that reason launching any Intel app will show me a prompt to first download and install Rosetta, with a GB amount noted, between 5-10 GB if I remember correctly.

Your GRASS Apple ARM binaries both show that same Rosetta installation prompt upon launch, with no other way to proceed.

In comparison, most other Apple Silicon labelled app binaries I tried, eg. Solvespace, run with no Rosetta prompt and requirement, as expected.

However, as mentioned before, a second Apple Silicon labelled app binary, FreeCAD, also causes the Rosetta prompt on my system, making the possibility of a Sonoma Beta bug a bit more likely.

Apple, AFAIK, have already reached the RC phase of the Beta period though, and I have encountered this issue with no other apps than these two.

I found this article picturing the Rosetta 2 install prompt I mention, proving the veracity of my account, in addition to all but confirming the suspected difficulty to remove it after installation.


GH


On 2023-09-18, at 3:28 AM, Michael Barton <Michael.Barton at asu.edu> wrote:

 Mac ARM does not require Rosetta. I am using it on my MacBook Pro 2023 without Rosetta.

I'm not sure what you mean by keeping your system free of Rosetta or changes in your system installation. I'm running MacOS 13.5.1. AFAIK, there is no Mac OS installation option to include or not include Rosetta.

GRASS makes no changes to the OS. All dependencies are within the app.

Michael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 17, 2023, at 6:24 PM, Gregor Hintner <gregorhintner at icloud.com> wrote:

I have no practical way to run GRASS since the Mac ARM version requires Rosetta. I want to keep my system free of Rosetta, or any irreversible changes it might make in my system installation.

In order to run GRASS I would need an actual Apple Silicon native binary.

I hope I read the question correctly this time.


Thanks,
G

On 2023-09-18, at 3:13 AM, Michael Barton <Michael.Barton at asu.edu> wrote:

 You misunderstand my question. Did you try to import a DWG into GRASS? If so, what steps did you go through and what was the output in the console?

MIchael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 17, 2023, at 5:29 PM, Gregor Hintner <gregorhintner at icloud.com> wrote:

Hours of online research, this stackoverflow post mentioning GDAL as at least one possible DWG GeoJSON bridge, and finding GRASS as one of the only actively maintained Mac compatible GIS tools.

I find it puzzling that AutoDesk themselves offer almost no export format choices for AutoCAD for Mac, see this support article, and no JSON export for somewhat more capable Windows version.


G


On 2023-09-18, at 2:16 AM, Michael Barton <Michael.Barton at asu.edu> wrote:

 Gregor,

I am asking how you are trying to import DWG files in GRASS? What steps dod you go through? You must have done something in order to get the behavior you are asking about.

Michael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 17, 2023, at 4:50 PM, Gregor Hintner <gregorhintner at icloud.com> wrote:

I have no previous experience with GRASS, I can specify no specific modules.

I simply wanted to find an Apple Silicon compatible map authoring tool that allowed me to, import, view and edit property line geometry from a DWG file.
I might have misjudged the feature scope of GRASS for that purpose.

In regard to listing a release as “Apple ARM”, I would expect it to only contain fully ARM native code, and no x86 architecture dependencies.
I really see no room for negotiation or interpretation here.


Gregor


On 2023-09-18, at 1:27 AM, Michael Barton <Michael.Barton at asu.edu> wrote:

 These are up to date. The ARM apps are set up to not require Rosetta for normal GRASS modules. However, whether or not a piece of code will run natively with Apple Silicon depends on how that code was developed and its dependencies. I am compiling the normal GRASS source code, however it is designed.

You say that you "hoped for GRASS GIS to help me on the DWG to GeoJSON conversion and editing". Which GRASS modules are you using for this? If it is a regular GRASS module, then the best bet is to contact the developer who is maintaining that module or to post your question on the GRASS dev list.

Michael
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 16, 2023, at 4:42 PM, Gregor Hintner <gregorhintner at icloud.com> wrote:

- GRASS 8.3.0 Apple ARM, 23/6/24
- GRASS 8.4dev Apple ARM, 23/8/14

both downloaded today from cmbarton.github.io/grass-mac/download .
Both prompted for Rosetta during launch.

U subsequently did encounter the same unexpected Rosetta prompt from the Mac ARM version 0.21.1 of freecad , so who knows whether macOS Sonoma does trigger some unexpected incompatibility. Other third party Apple Silicon, ARM releases run just fine though, eg. solvespace and everything published on the App Store of course.


Gregor


On 2023-09-16, at 8:12 PM, Michael Barton <Michael.Barton at asu.edu> wrote:

 Greg,

Can you tell me which version you downloaded, when you downloaded it, and when it was compiled

Michael Barton
_____________________________
C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton


On Sep 16, 2023, at 7:44 AM, Gregor Hintner <gregorhintner at icloud.com> wrote:

Dear Prof. Barton,


thank you for maintaining GRASS GIS bundles for, indeed, the world’s best computers.

I have no previous GIS experience, but have come to look for a way of converting positioning data, delivered to me in 3D DWG format from a land survey assignment, to IGES or STEP, and GeoJSON for further use.

I had hoped for GRASS GIS to help me on the DWG to GeoJSON conversion and editing side, but your most recent listed stable and development Apple ARM releases have both asked for Rosetta ton run.
May I ask you to help me understand why?

I do run the latest MacOS Sonoma Beta, I see no reason how or why this should affect Rosetta requirement however.



Kind regards,
Gregor Hintner











_______________________________________________
grass-dev mailing list
grass-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20230922/6bd56448/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Apple-Silicon-Rosetta-2-and-the-Challenges-for-Endpoint-Security-7.jpg
Type: image/png
Size: 109240 bytes
Desc: Apple-Silicon-Rosetta-2-and-the-Challenges-for-Endpoint-Security-7.jpg
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20230922/6bd56448/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9082.png
Type: image/png
Size: 129008 bytes
Desc: 9082.png
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20230922/6bd56448/attachment-0003.png>


More information about the grass-dev mailing list