We need to run everything under x86 emulation, because Powershell needs opensslv1 and opensslv1 only builds under x86.
Create home directory and script to launch x86 shell:
mkdir -p $HOME/x86shell
cat <<EOF > $HOME/x86shell/.bash_profile
export PATH=$PATH:/usr/bin
export PATH=$PATH:/usr/sbin
export TERM=xterm-color
EOF
cat <<EOF > $HOME/x86shell/run.sh
#!/usr/bin/env -i HOME=$HOME/x86shell arch -x86_64 /bin/bash
bash
EOF
chmod +x $HOME/x86shell/run.sh
Start x86 shell:
cd $HOME/x86shell
./run.sh
Install homebrew (x86 version). Don't worry, it will install to /usr/local
and remain separate from your arm64 version (at /opt/homebrew
):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install powershell (x86 cask):
brew install powershell
The Powershell homebrew package is marked as requiring openssl@3, but Powershell is actually built to dynamically load opensslv1 (see #5561). So we need to build and install opensslv1.
Unlink the existing openssl@3:
brew unlink openssl@3
brew unlink openssl
Install opensslv1:
curl -o openssl.rb https://gist.githubusercontent.com/dansimau/2b29a6d8d8b8950b6bfae1f8235e1da1/raw/e3c30e96702a8e507a29ebbfafbede2bee07a63e/openssl.rb && brew install ./openssl.rb
Launch powershell:
pwsh
Install required modules (do these line by line, as they are interactive):
Install-Module -Name ExchangeOnlineManagement
Install-Module -Name PSWSMan
Install-Module -Name AzureAD
Test by logging into Exchange (it will open a browser window to authenticate):
Connect-ExchangeOnline
If successful you will see:
PS /private/tmp> Connect-ExchangeOnline
----------------------------------------------------------------------------
The module allows access to all existing remote PowerShell (V1) cmdlets in addition to the 9 new, faster, and more reliable cmdlets.
|--------------------------------------------------------------------------|
| Old Cmdlets | New/Reliable/Faster Cmdlets |
|--------------------------------------------------------------------------|
| Get-CASMailbox | Get-EXOCASMailbox |
| Get-Mailbox | Get-EXOMailbox |
| Get-MailboxFolderPermission | Get-EXOMailboxFolderPermission |
| Get-MailboxFolderStatistics | Get-EXOMailboxFolderStatistics |
| Get-MailboxPermission | Get-EXOMailboxPermission |
| Get-MailboxStatistics | Get-EXOMailboxStatistics |
| Get-MobileDeviceStatistics | Get-EXOMobileDeviceStatistics |
| Get-Recipient | Get-EXORecipient |
| Get-RecipientPermission | Get-EXORecipientPermission |
|--------------------------------------------------------------------------|
To get additional information, run: Get-Help Connect-ExchangeOnline or check https://aka.ms/exops-docs
Send your product improvement suggestions and feedback to [email protected]. For issues related to the module, contact Microsoft support. Don't use the feedback alias for problems or support issues.
----------------------------------------------------------------------------
PS /private/tmp>
This appears to happen as Homebrew x86 installs itself using sudo and then your own user cannot write to the logs directory, e.g.:
Error: An exception occurred within a child process:
Errno::EACCES: Permission denied @ dir_s_mkdir - /var/folders/sc/rcd0dtvx41n7lptggpq0nxzr0000gn/T/tmp.IervRAEv/Library/Logs
You can fix it by running chown
on this directory, e.g.:
sudo chown -R dan /var/folders/sc/rcd0dtvx41n7lptggpq0nxzr0000gn/T/tmp.IervRAEv/Library
You'll need to replace the temp directory name above with the one in your own output.
opensslv1 fails to link with Directory not empty
or Refusing to link macOS provided/shadowed software: openssl
On my machine, which already had an x86 version of Homebrew, I got an error because /usr/local/opt/openssl
was not empty:
Error: Directory not empty @ dir_s_rmdir - /usr/local/opt/openssl
My solution was to remove this directory and manually re-link:
mv /usr/local/opt/openssl /usr/local/opt/openssl.old
ln -s /usr/local/Cellar/openssl/1.0.2t /usr/local/opt/openssl