Readit News logoReadit News
ryancnelson · 5 years ago
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...)"

xenadu02 · 5 years ago
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.

api · 5 years ago
Would be easy to make iTerm2 launch arch -x86_64 <shell>
unix-boomer · 5 years ago
Well, this is something nice. Looks like it will help developers transition to the new architecture.
Aperocky · 5 years ago
Does this make brew compile subsequent binaries in x86 though? Or is it purely cosmetic.
woodruffw · 5 years ago
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.
JoshuaMulliken · 5 years ago
Awesome! I didn't know that.

Thanks for sharing that will definitely come in handy!

Aperocky · 5 years ago
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)

Deleted Comment

Ericson2314 · 5 years ago
I wonder if Nix on macOS could become a better homebrew-killer by supporting Apple Silicon first. We already do aarch64-linux natively and some iOS cross compilation, so that should give us a head start.
rjzzleep · 5 years ago
I was using gentoo-prefix for the longest time on MacOS.

I never got why homebrew got so popular given how terrible it is. But it was more accessible to people unfortunately. I spent some time trying to become a Gentoo developer for a while and then just gave up because there was no response.

I used to updated the clang patches to make newer clang versions compile things on osx before most of those things made it upstream.

I think it's vastly superior to macports and while I find nix interesting I don't really find it that practical. I think what makes homebrew more popular than the rest is how many precompiled packages exist. If gentoo-prefix had the same amount of precompiled packages, then I'd think it would definitely be much better for most users.

[1] https://wiki.gentoo.org/wiki/Project:Prefix

[2] https://github.com/fishman/timebomb-gentoo-osx-overlay

siraben · 5 years ago
Which aspects of Nix would you say are "not practical"?
k2enemy · 5 years ago
I wonder if the impressive compile times coming out of M1 will make pre-built binaries less important?
siraben · 5 years ago
Related issue[0].

I moved over from Homebrew to Nix around 5 months ago, haven't since needed to use Homebrew except for casks.

[0] "Support for Apple Silicon (aarch64-darwin)" https://github.com/NixOS/nixpkgs/issues/95903

soraminazuki · 5 years ago
It can replace casks too, as mac apps can also be packaged in Nix.
mlindner · 5 years ago
I'm glad I'm not the only one hating homebrew. It's become very anti-user in the past few years under the new maintainers. Even the original maintainer has said publicly that he doesn't like the direction the new maintainers took homebrew. All the changes the current maintainers of homebrew have made have been in the direction of "make maintaining homebrew easier so we get less questions" without any thought to the user experience those changes cause.
Hackbraten · 5 years ago
> without any thought to the user experience those changes cause.

Sorry you get that impression. As one of the maintainers, my impression is that each decision happens in good faith, and usually follows a controversial discussion, which puts user experience on par with maintainers’s well-being.

Examples off the top of my head:

[1]: https://github.com/Homebrew/brew/pull/9172#issuecomment-7299...

[2]: https://github.com/Homebrew/brew/issues/9177#issuecomment-72...

[3]: https://github.com/Homebrew/brew/issues/9099#issuecomment-72...

That’s not to say your feelings aren’t valid. I can see how some unpopular decisions may come across as rude, thoughtless or selfish. I’m aware that this is still a huge issue, and my feeling is that we still have a lot to learn in order to get better and more transparent at communicating.

I’m thankful for feedback like yours (even though I strongly disagree with the part that I’ve quoted). You can be sure any such feedback has a real, positive impact on where we’re heading as a project.

rswail · 5 years ago
macports is a better homebrew-killer IMHO. Follows MacOS guidelines and frameworks, integrates with the MacOS way in terms of launch agents etc.
dehrmann · 5 years ago
I gave up on homebrew and switched to macports after having to change directory permissions one time too many.
Siira · 5 years ago
Macports doesn’t install for me with no error messages.
mekster · 5 years ago
What we need is a cross platform package manager that installs stuff in the same place and make stuff behave the same, so shell configs can be unified between OS and not have "if" all over and expect same environments.

nix is almost that, except some packages are too old but otherwise, I have it running identically on macOS and Linux.

Homebrew puts stuff in some weird location that is /home/linuxbrew/.linuxbrew/ on Linux and that alone puts me off and it breaks if I change that location. No idea why they don't just use a path like /opt/homebrew/ for both OS and be done with it.

mschuster91 · 5 years ago
And especially it follows common Unix traditions - packages are installed in a system wide way without permission fuck-ups.
soraminazuki · 5 years ago
Nix also runs and integrates with macOS too. Does macports do something that Nix doesn’t?
lloeki · 5 years ago
Over here I’m dying to port ArchMac to aarch64, which should be reasonably quick... if I had access to Apple Silicon hardware.

Being a lonely maintainer means I’m a bit (a lot) late on package versions and some areas are hacking, but it works on Big Sur already. But then again I’m also most probably the sole user and only target audience given the popularity of alternatives.

Deleted Comment

jpetrucc · 5 years ago
I recently began using Nix as such on my current MBP - I'm a big fan!
sjmulder · 5 years ago
pkgsrc, 'the portable package manager', support Apple Silicon:

http://pkgsrc.org/

No binary packages yet, but using it from source is pretty much a matter of downloading and extracting the 'current bz2', then:

    cd pkgrsc/bootstrap
    ./bootstrap --prefix=/opt/pkg
The default prefix is /usr/pkg, but that's protected by macOS' SPI. You might want to add /opt/pkg/bin and sbin to your $PATH. Then to install a package:

    cd pkgsrc/sysutils/nnn
    bmake install clean
Full documentation, including on how to create your own packages:

http://www.netbsd.org/docs/pkgsrc/

pierrebeaucamp · 5 years ago
Thanks so much for the comment - I was trying to do that with the stable source yesterday evening with no success. Saw your tweet too, but don't have Twitter to ask you over there.

Current source works fine

Aperocky · 5 years ago
That's not needed though, I manually extracted brew to /opt/homebrew per https://docs.brew.sh/Installation, and it works just fine in the native terminal.

file htop returns

htop: Mach-O 64-bit executable arm64

So this version of brew is compiling native arm64 code.

alwillis · 5 years ago
Keep in mind that if you're using a Homebrew version of something Apple ships with macOS, for now, you'll get x86-64 binaries while Apple's version is a universal app and will run natively on the M1.

Zsh from Homebrew: /usr/local/bin/zsh: Mach-O 64-bit executable x86_64

Apple's Zsh:

    /bin/zsh: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit
    executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
    /bin/zsh (for architecture x86_64): Mach-O 64-bit executable x86_64
    /bin/zsh (for architecture arm64e): Mach-O 64-bit executable arm64e
The Homebrew team is making progress; I've been seeing Big Sur "bottles" for a couple of days now.

Aperocky · 5 years ago
That's good to know, have any of you tried bash? Bash for some reason can't be launched on multiple terminals and if tried it crashes.
teilo · 5 years ago
No, not even close. There is more that doesn't work than works. Of what I use, all I got was python3 and git. But no python3.8, no ffmpeg, no erlang, no gnutls, and on and on.

https://github.com/Homebrew/brew/issues/7857

FraKtus · 5 years ago
There is no need of homebrew to install ffmpeg on Apple Silicon. I could just ./configure and make on the DTK.

ffmpeg has so many configure options, I always avoid building it with brew.

x0x0 · 5 years ago
I looked through brew.sh. Apologies if I'm missing something, but I don't think I am.

There's something really offensive about apple being too cheap to just pay some homebrew devs. And dumping the work of the arch swap onto charity effort.

macintux · 5 years ago
It doesn’t look like it’s fully baked yet.

https://github.com/Homebrew/brew/issues/7857

Aperocky · 5 years ago
Yes I received very specific warning that I'm in uncharted waters.

But I still wanted ARM binaries, the ones I did (htop, imagemagick, tmux etc) all worked.

Smoosh · 5 years ago
* not fully fermented
zymhan · 5 years ago
Does Macports support Apple ARM? They have a Big Sur compatible version, so I'm inclined to think it can at least try compiling natively.

https://www.macports.org/install.php

rswail · 5 years ago
Not all the ports in macports are big sur ready for x86.

There are some dependencies in autoconf about warnings vs errors in defining implicit functions that has caught out some ports and others that use the "search for the .so" instead of dlopen to check for a library.

clang now defaults to error if you turn on the implicit-function-definition warning. [1]

Big Sur doesn't actually store the .so files for system libraries, it has one big .sym/.so for all of them. [2]

[1] https://developer.apple.com/documentation/xcode-release-note... under Apple Clang Compiler:

Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)

[2] https://developer.apple.com/documentation/macos-release-note... under Kernel:

New in macOS Big Sur 11.0.1, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to dlopen() the path, which will correctly check for the library in the cache. (62986286)

saagarjha · 5 years ago
Yes, it does.
harrygeez · 5 years ago
yes if a precompiled version doesn't exist it will compile on your machine
therealmarv · 5 years ago
That won't help running Docker and VirtualBox. There's also a big chance VirtualBox will never make it to M1 ;(
jeroenhd · 5 years ago
AS has support for virtualisation so VirtualBox will probably make it, but most likely only for running operating systems that run on ARM. There's very little preventing VB for being used as a tool to run the ARM versions of Linux or your favourite flavour of BSD, but Windows probably won't work (not until MS releases a download for Windows on ARM, at least). So, VirtualBox itself will work, but using it to run Windows applications won't.

The same is true for Docker, when someone gets a Linux VM to boot, Docker becomes a possibility just like on a normal version of macOS.

In the end I think it's only a matter of time before someone manages to combine Rosetta and virtualisation instructions (even though Apple says they don't support it) and fast-ish x64 emulation becomes a possibility. It will likely require some huge hacks that won't be allowed into the app store, but if Apple doesn't lock down the platform more with upcoming OS releases, developers and other technical-minded people will run that stuff just fine.

my123 · 5 years ago
VirtualBox won't be ported to any Arm64 platform, Oracle explicitly said that they wouldn't do it.

However, Parallels and VMWare Fusion will. You'll also have other solutions around.

Also, no App Store requirement on macOS at all.

WatchDog · 5 years ago
There are windows aarch64 builds available via various means. Although the windows arm software ecosystem is dismal.
lights0123 · 5 years ago
Huh, so Apple is installing both the ARM and x86 version of apps, even on ARM computers. I guess that makes sense for portability, but I don't know if other parts of the root filesystem are one architecture only, such as the path to the kernel (unless that's a fat binary too?).
brigade · 5 years ago
In the PPC -> x86 transition, the same hard drive could be used to boot both PPC and x86 Macs (e.g. via target disk mode or external HDDs)
saagarjha · 5 years ago
That remains true today.
crb002 · 5 years ago
What is the binutil to strip the x86? Is it still this command? http://hints.macworld.com/article.php?story=2005081011242266...

--edit-- Sweet it works.

cd /Applications; ditto --rsrc --arch arm64 GarageBand.app GarageBand-arm64.app

alwillis · 5 years ago
Everything Apple’s responsible for is a Universal (or fat) binary.

You can boot either architecture from a Big Sur drive.

saagarjha · 5 years ago
The kernel is multiple files. There’s “kernel” for Intel Macs, “kernel.release.t8020” for DTK users, and “kernel.release.t8101” for the M1.
olliej · 5 years ago
I good case where this would be necessary is if anything has in process plugins - I saw at least one review where the person had to restart their app (final cut maybe?) because the codec was an x86 binary - which it seemed to do more or less automatically.
varispeed · 5 years ago
Would running X86 require licensing? If Intel doesn't say anything then could Apple in a couple of years develop their own X86 CPU by turning Rosetta into a hardware solutions? Technically it should be possible - as Transmeta has done something similar, but cannot find if they got a license from Intel or it was not needed. https://en.wikipedia.org/wiki/Transmeta
soraminazuki · 5 years ago
It’s likely not what Apple needs, though. They probably need a solution they can maintain long enough to let the transition through, but not any longer. They’d drop support for x86 as soon as enough applications gain support and existing x86 products get dated. Maybe 5 years?
mlindner · 5 years ago
I've read that Rosetta 2 doesn't actually emulate x86 and only emulates x86_64 which is owned by AMD, not Intel.