Hello if unfortunately or necessarily you are working with MacOS 11 Big Sur. And you try uninstall brew erlang to reinstall it with asdf seems that you will not be able to reinstall that version with asdf, kerl or brew, even building Erlang / OTP from scratch will not be possible for OTP 23.0.3.
It seems that the only version that builds for MacOSX 11 is Erlang/OTP24. With 23.0.3 you will have:
````
checking OTP version... 23.0.3
configure: error:
You are natively building Erlang/OTP for a later version of MacOSX
than current version (11.0). You either need to
cross-build Erlang/OTP, or set the environment variable
MACOSX_DEPLOYMENT_TARGET to 11.0 (or a lower version).
````
Try to set MACOSX_DEPLOYMENT_TARGET to 11.0 or 10.5 doesn't seems to work
export MACOSX_DEPLOYMENT_TARGET=11
I have only been able to build Erlang on MacOSX 11 by following this bug note. But only in OTP 24.
https://bugs.erlang.org/browse/ERL-1305
and compile Erlang from source:
Is there any advance with support for MacOS 11? or someone facing problems with erlang 23.0.3 in MacOS 11?
Related issue-> Kerl
UPDATE!!! To compile Erlang 23.0.3 from source yo can use "maint" brach, they rebased bugs related with MacOS 11 builds into that branch.
this is also an issue with 23.1.2 at least
Hi, can you share the command that you used to install erlang from the maint branch?
I am running asdf install erlang ref:maint but it isn't doing anything
Hi,
If you are open to using kerl I added a solution to https://github.com/kerl/kerl/issues/346.
If you want you can also edit the downloaded source by asdf, but then you'd have to edit the .tar.gz as the source is cleaned before every build.
I checked master and I don't think it's fixed when you are running OSX 11.0.1. Related: https://github.com/erlang/otp/pull/2865
Thanks @luos , modifying the source worked well building v23.1.4. Just to add some context for others:
cd ~/.asdf/plugins/erlang/kerl-home/archives
tar zxvf OTP-23.1.4.tar.gz
Modify ~/.asdf/plugins/erlang/kerl-home/archives/otp-OTP-23.1.4/make/configure.in line 415 as mentioned in kerl/kerl#346 to read:
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > $int_macosx_version && false
Re-tar the directory:
tar cfz OTP-23.1.4.tar otp-OTP-23.1.4
rm -rf otp-OTP-23.1.4
Then install like normal:
asdf install erlang 23.1.4
Thanks @rrosiek for setting the path. I had to change the argument when creating the new tar because the command line you mentioned created only a .tar file and I feel asdf expects a .tar.gz file.
So the command I used to re-tar the directory:
# delete the previously downloaded `.tar.gz` file
rm OTP-23.1.4.tar.gz
# re-tar
tar czvf OTP-23.1.4.tar.gz otp-OTP-23.1.4
# delete the previously decompressed tar file
rm -rf otp-OTP-23.1.4
And then the install worked properly as you mentioned.
In case you're using ruplacer:
ruplacer --go '(#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > \$int_macosx_version)' '$1 && false'
There's now a patch in kerl for this https://github.com/kerl/kerl/pull/356
Is there anything necessary on the asdf-erlang side to make use of it?
I know this issue is about version 23.0.3 but it appears this is no longer a problem on erlang 23.2. I had the same issue with previous versions but installing erlang 23.2 worked for me:
asdf install erlang 23.2
I wrote the universal script. Just change ERLANG_VERSION.
export ERLANG_VERSION=22.3
cd ${ASDF_DATA_DIR:-$HOME/.asdf}/plugins/erlang/kerl-home/archives
tar zxvf OTP-$ERLANG_VERSION.tar.gz
sed -i '' -e 's/> $int_macosx_version/> $int_macosx_version \&\& false/' ./otp-OTP-$ERLANG_VERSION/make/configure.in
rm OTP-$ERLANG_VERSION.tar.gz
tar czvf OTP-$ERLANG_VERSION.tar.gz otp-OTP-$ERLANG_VERSION
rm -rf otp-OTP-$ERLANG_VERSION
For installing 21.3.7.1, I had to make one modification to @7rulnik's script, changing ./otp-OTP-$ERLANG_VERSION/make/configure.in to ./otp-OTP-$ERLANG_VERSION/configure.in (seems like maybe the path to the file changed between versions 21 and 22). If you're running into a "configure.in: No such file or directory" error from sed, that change might be what you need to get that script working for you.
Thanks @luos , modifying the source worked well building v23.1.4. Just to add some context for others:
cd ~/.asdf/plugins/erlang/kerl-home/archives tar zxvf OTP-23.1.4.tar.gzModify ~/.asdf/plugins/erlang/kerl-home/archives/otp-OTP-23.1.4/make/configure.in line 415 as mentioned in kerl/kerl#346 to read:
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > $int_macosx_version && falseRe-tar the directory:
tar cfz OTP-23.1.4.tar otp-OTP-23.1.4 rm -rf otp-OTP-23.1.4Then install like normal:
asdf install erlang 23.1.4
I had the same issue after upgrading an elixir application first to erlang 23.3.4.3 and elixir 1.12.1 and then downgrading again to
erlang 22.3.4.12 elixir 1.10.4. This solution did not work for me.
What worked however was:
asdf plugin remove erlang
asdf plugin add erlang
asdf reshim erlang 22.3.4.12 # <- probably not needed
asdf install erlang 22.3.4.12
asdf install elixir 1.10.4
Hope that helps someone.
Most helpful comment
Thanks @rrosiek for setting the path. I had to change the argument when creating the new tar because the command line you mentioned created only a
.tarfile and I feel asdf expects a.tar.gzfile.So the command I used to re-tar the directory:
And then the install worked properly as you mentioned.