News for hackers. Stuff that matters.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by ryancnelson on Tuesday November 17, 2020 @09:53PM (#25132679)
There's also the "arch" command, to run commands under rosetta2

I just installed Homebrew on my new m1 MacBook Air with:

$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/in...)"

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by xenadu02 on Wednesday November 18, 2020 @03:52AM (#25134535)
Stickiness of architecture is a change from how Rosetta worked in the PowerPC to Intel transition: in macOS Big Sur child processes will prefer the arch of the parent process if one is available to maximize compatibility. So for example launching x86_64 sh will cause a python invocation from that shell to also be x86_64.

The "arch" utility is your escape hatch to switch the preferred arch for the spawned process and all of its children.

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by api on Wednesday November 18, 2020 @08:36AM (#25136522)
Would be easy to make iTerm2 launch arch -x86_64 <shell>
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by jen20 on Wednesday November 18, 2020 @10:16AM (#25137643)
I haven't tried this (don't have an M1 to hand!) but:

iterm2 -> Preferences -> Profiles -> General

Change the "Login Shell" drop down to "Command" and then enter `arch -x86_64 /usr/local/bin/zsh` or whatever your shell is.

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by 1f60c on Wednesday November 18, 2020 @10:38AM (#25137942)
Would `arch -x86_64 $SHELL` work?
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by dormento on Wednesday November 18, 2020 @12:21PM (#25139486)
In theory yes, since it inherits the shell env from the parent.

Haven't got the $$$ to test though.

EDIT: you could also craft an oneliner if $SHELL is not defined, something like:

`ps -T $$ | awk 'NR==2{print $NF}' | arch -x86_64 $0`

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by cdalar on Monday November 23, 2020 @02:59PM (#25191027)
Just tried and it works :) .. Nice.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by unix-boomer on Wednesday November 18, 2020 @07:28AM (#25136011)
Well, this is something nice. Looks like it will help developers transition to the new architecture.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by Aperocky on Tuesday November 17, 2020 @09:57PM (#25132700)
Does this make brew compile subsequent binaries in x86 though? Or is it purely cosmetic.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by woodruffw on Tuesday November 17, 2020 @10:08PM (#25132754)
Homebrew maintainer here. We don’t officially support Big Sur yet, but installing it via Rosetta will cause it to fetch x86 bottles instead of ARM ones. At least, that’s the plan.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by frakkingcylons on Wednesday November 18, 2020 @01:40AM (#25133831)
Off-topic: Thanks for working on Homebrew btw! It just occurred to me that I've never donated despite using it so much but now I have. Link for others:

https://github.com/homebrew/brew#donations

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by woodruffw on Wednesday November 18, 2020 @09:48AM (#25137324)
Thank you for the kind words, and for the donation!
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by Aperocky on Tuesday November 17, 2020 @10:09PM (#25132763)
Ah.. I've extracted homebrew manually and it's been compiling ARM binaries for me - which is what I wanted it to do.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by Hackbraten on Wednesday November 18, 2020 @02:11AM (#25133995)
If you’re ok with numerous formulae still breaking, you’ll be fine.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by dgdosen on Thursday November 19, 2020 @10:46PM (#25157141)
Seemed to work fine for me... I'm now trying to install both versions of brew and spin up terminal sessions accordingly.

Are these 'good practices' for Arm Macs?:

1) When spinning up an iTerm session, figure out if it's 'Darwin x86_64' or 'Darwin arm64' - and configure paths accordingly. so they use the right brew binaries.

2) Easily double check what version of a running package/keg based on what arch is displayed in Activity Monitor.

3) That way, you can just use brew with Rosetta to start (which I did) then build up native arm Brew over time. and let the Rosetta brew fall away.

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by somesortofsystm on Wednesday November 18, 2020 @06:58AM (#25135819)
Does this plan include differentiating at the Casks as well? (Thanks for the work on homebrew, I live by it - its key to my use of MacOS ..)
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by KMnO4 on Wednesday November 18, 2020 @09:20AM (#25137009)
Casks are typically precompiled application binaries, and I assume most applications (that choose to support M1) will be Universal Binaries soon. Casks would not need to change anything.
[dead]
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by dividedbyzero on Wednesday November 18, 2020 @04:02AM (#25134599)
Would you mind sharing how you disable that?
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by lightbulbjim on Wednesday November 18, 2020 @04:21AM (#25134749)
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by Fnoord on Wednesday November 18, 2020 @06:03AM (#25135404)
Is this actually GDPR compliant as it is?
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by sigzero on Wednesday November 18, 2020 @07:57AM (#25136218)

  Homebrew gathers anonymous aggregate user behaviour 
  analytics using Google Analytics. You will be notified the 
  first time you run brew update or install Homebrew. 
  Analytics are not enabled until after this notice is shown, 
  to ensure that you can opt out without ever sending 
  analytics data.
That is from the Homebrew site.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by disgruntledphd2 on Wednesday November 18, 2020 @06:48AM (#25135755)
If it doesn't ask for consent and stores PII then no, it's not.
Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by woodruffw on Wednesday November 18, 2020 @09:55AM (#25137408)
Homebrew does not and has never stored any PII. You can read exactly what we store here[1].

[1]: https://docs.brew.sh/Analytics

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by sneak on Wednesday November 18, 2020 @07:56AM (#25136202)
It's a Google Analytics client (using curl), so they punt on the GDPR issue to Google, who has a little "scrub client IP" checkbox in GA, which Homebrew has checked.

This is fine, because Google can be trusted to come into possession of your uniquely-identified tracking data, and then immediately delete it, without letting military intelligence log it in the process. They have no reason to share it (other than the legal compulsion that FAA 702 provides) or keep it around, as it would not profit them in any way (other than their multibilliondollar advertising business).

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by JoshuaMulliken on Tuesday November 17, 2020 @10:50PM (#25133004)
Awesome! I didn't know that.

Thanks for sharing that will definitely come in handy!

Re:Run x86 Apps (including homebrew) in the Terminal on Appl... by Aperocky on Tuesday November 17, 2020 @10:54PM (#25133019)
Be warned that:

> Homebrew maintainer here. We don’t officially support Big Sur yet, but installing it via Rosetta will cause it to fetch x86 bottles instead of ARM ones. At least, that’s the plan.

It will create X86 binaries instead of ARM ones. (which might be a plus at the current moment)