Resilience and Recovery: Navigating A Mac Failure and Running SQL Server on ARM-Based Macs
? 2023 Donnie Wishard. All rights reserved.

Resilience and Recovery: Navigating A Mac Failure and Running SQL Server on ARM-Based Macs

Recently, I faced a complete failure on my Intel-based MacBook Pro. Despite attempts to boot, repair, and recover using the built-in macOS tools, I found myself unable to regain access to both my data and my VMware Fusion Windows Server virtual machine (VM). (I prefer Windows development on Mac within a VM.) Fortunately, I had a Time Machine backup, but restoring to the machine proved challenging due to hardware errors. Frustrated, I headed to the Apple Store and purchased a new MacBook Pro with the M3 Max chip.

After restoring the Time Machine backup, I believed I was back in business. However, I overlooked the transition from an Intel to an Apple chip, rendering my Windows VM incompatible. Thankfully, a solution emerged: utilizing Windows 11 ARM as my VM. The installation was quick, lightweight, and seamlessly operational. At this point, I had Mac data but lacked Windows data (files, code, databases) as the old VM was unusable.

To resolve this, I connected another external SSD drive to the old machine, facilitating the transfer of files from the VM to the disk and subsequently back into the new Windows 11 VM. This process worked perfectly, and I had all my Windows data recovered. The next step was installing the development tools, including Visual Studio 2022, SQL Server Management Studio (SSMS), and SQL Server Express. While Visual Studio and SSMS installed effortlessly, SQL Server presented a challenge.

?Perplexed, I discovered that SQL Server did not support running on ARM chips. This posed a significant issue as I often run local SQL Server databases for proofs of concept and during instances when I lack access to Azure, such as when on an airplane.

After a little searching, a solution emerged: running Docker Desktop in macOS Sonoma and pulling the Azure SQL Edge container image. With this approach, I successfully ran SQL Edge and connected to it from SSMS within my Windows 11 VM.

Here are the steps taken to accomplish the above.

  • Download and Install Docker Desktop: Docker Desktop (Choose "Download for Mac Apple Chip")
  • Get the SQL Azure Edge Container Image: Open Terminal and run the following command:

docker pull mcr.microsoft.com/azure-sql-edge        

  • Run Docker Container: Run the following command in Terminal (set MSSQL_SA_PASSWORD, and your-machine-sql to your specific values):

docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=xxxxxxxx' -p 1433:1433 --name your-machine-sql -d mcr.microsoft.com/azure-sql-edge        

(Check Docker Desktop to verify it is running)

  • Connect from SSMS in VM:Server Name: Your-Machine-Name.localUser Name: saPassword: xxxxxxxx (password stated above)
  • At this point, you can connect and run SQL Server on your ARM-based machine. If the docker command is not recognized, ensure you set the environment variables:

export PATH="$PATH:/Applications/Docker.app/Contents/Resources/bin/"        

  • You may also need to add the following line to the ~/.zshrc file:

alias docker="/Applications/Docker.app/Contents/Resources/bin/docker"        

As this experience highlights, relying solely on regular backups may not always be sufficient for fully restoring your system. If you find yourself in a similar situation, I hope you find this information useful.


Donnie Wishard is a passionate and results-driven technology leader with over 20 years of hands-on experience in software architecture, development, management, and consulting. Connect with Donnie on?LinkedIn!

Franck Lamandé

Administrateur base de données SQL Server / DevOps

7 个月

Hello Donnie, thank you for your post on this subject. I am a french SQL Server database administrator and i will plan to buy a Apple MacBook pro M3 for personal usage. Like you, i will install a SQL Server instance with Docker on my future macbook. For me, the tricky step will be the installation of SQL Server Management Studio on my future macbook. If I understood correctly, you created a virtual machine on your ARM macbook, then installed Windows 11 (ARM version) ans SSMS on this virtual machine. Is that right ? And which virtualization software do you have installed on your ARM macbook ? Thank you for your reply and any information. Best regards, Franck

回复

要查看或添加评论,请登录

Donnie W.的更多文章

社区洞察

其他会员也浏览了