Running hdbcli on an Apple M1 chip: an alternative way with using arch command
|Update from 2023/01: The ARM version of SAP HANA Clients for macOS is available as of version 2.15, for example from https://tools.hana.ondemand.com/#hanatools.|
Last week I switch from using an Intel-based MacBook laptop (x86 architecture) to one with Apple M1 (ARM64 architecture).
A look at
I tried an alternative approach, that I would like to share here. It does not involve making a copy of the terminal application, but instead using
man arch explains:
By default, the operating system will select the architecture that most closely matches the processor type. … The
archcommand can be used to alter the operating system’s normal selection order.
archcommand with no arguments, displays the machine’s architecture type.
Let’s run the command without any parameters on a new laptop with an Apple chip. It should return
To run a command that supports
x86_64 translation mode, you can execute:
/usr/bin/arch -arch x86_64 <command>
One more helpful command will be
sysctl to display, if a process is native or translated.
sysctl sysctl.proc_translated /usr/bin/arch -arch x86_64 sysctl sysctl.proc_translated
A command or a binary you are running needs to support a given architecture as can be checked using
file $(which sysctl) file $(which zsh)
Interestingly, MacOS default’s Python is a universal library…
file $(which python3) python3 -V arch -arch x86_64 python3 -V
…which Python installed with
conda is ARM64-only:
file $(which python) python -V arch -arch x86_64 python -V
Attempt to install
pip on Apple silicon
If I try to install
pip today (with no “universal” version of HDBCLI for Apple M1 available yet), then I get:
ERROR: Could not find a version that satisfies the requirement hdbcli (from versions: none)
ERROR: No matching distribution found for hdbcli
And what about the Miniconda?
Let us create a separate
myhana Conda’s environment…
conda create -n myhana python=3.9 conda activate myhana
Still the same.
Start a shell as the x86_64 process
Let’s start a shell with
x86_64 compatible architecture…
arch -x86_64 zsh export PS1='x86$ '
…and check the architecture set for the session.
arch uname -m
🤔 I must admit this
x86_64is still confusing me. I will appreciate, if you share your explanation in comments, should you know why these two values are different.
hdbcli in x86_64 process
Now that we are in the x86_64 translated process, let’s try installing
python3 -m pip install hdbcli python3 -m pip show hdbcli
And what about Miniconda environment?
Unfortunately, it does not work.
Bonus: Create a profile in a terminal application for an x86 translated mode
To streamline invoking a shell in an x86 translated mode you can create a separate profile.
I am using the iTerm2 application, so this is what my setup looks like.
- Make a copy of the Default profile and called it “Rosetta Shell”,
- Change Command setting from “Login Shell” to “Command” with the value
/usr/bin/arch -x86_64 /bin/zs.
As always, please share your ideas and feedback in the comments below!