小渔分享

小渔分享

youtube
bilibili
zhihu

How to Use iPad as the Only Main Display for Mac mini (Wi-Fi Version)

Cover 1024x576

Purpose: Use the iPad as the only main display for the Mac mini


Operation Document#

Created January 21, 2025

Creator Xiao Yu Share


Principle Analysis#

↓ Mind Map

Screenshot 2025-01-22_04.50.50

  • Explanation:
    • Here I made a sketch
    • Briefly explain the principle
    • The iPad and Mac mini need to be connected to the same Wi-Fi
    • The iPad uses the ssh command to find the Mac mini and start the Sidecar script code
    • The Mac mini will first check if there are available displays
    • Since there is no display, the iPad cannot enable Sidecar
    • Therefore, we need to create a virtual screen to pass the Mac mini's self-check
    • This way, the Mac mini can transmit the video image to the iPad

System Requirements for Enabling Sidecar#

Qmd6WHGJ8x9ZT74Cvx66XLPqJcT8usaUBRFAYxY7UrVuLr

Mac mini Operation Section#

↓ The detailed operation steps for Mac mini M4 are as follows

  • Search → Automator → Click New Document → Select Application → Search AppleScript
    • Copy the code into AppleScript

      Screenshot 2025-06-06_15.51.16

    • Sidecar Code

      • Change “This is the name of your iPad” to the iPad name
      • Followship connected ⇒ Sidecar connected
      • Not found ⇒ Not found
      on findLastTargetIndex(targetItem, itemList)
      
      	set lastIndex to 0
      
      	repeat with i from (count of itemList) to 1 by -1
      
      		if item i of itemList is targetItem then
      
      			set lastIndex to i
      
      			exit repeat
      
      		end if
      
      	end repeat
      
      	return lastIndex
      
      end findLastTargetIndex
      
      beep 1
      beep 1
      
      tell application "System Settings"
      
      	activate
      	delay 1
      
      	tell application "System Events"
      		tell process "System Settings"
      		
      			-- Click the "Display" menu item in the menu bar
      			click menu item "显示器" of menu "显示" of menu bar item "显示" of menu bar 1
      
      			delay 0.3
      
      			tell group 1 of group 2 of splitter group 1 of group 1 of window "显示器"
      				try
      					-- The system settings need time to load the right side interface after a cold start
      					delay 1
      					click pop up button "添加"
      
      					-- Get the names of all menu items in the "Add" menu
      
      					set menuItems to name of menu items of menu "添加" of pop up button "添加"
      
      					-- Find the index of the last matching item by name
      
      					set targetIndex to (my findLastTargetIndex("这里是自己iPad名称", menuItems))
      
      					-- Click the target menu item
      					delay 0.3
      					click menu item targetIndex of menu "添加" of pop up button "添加"
      
      					say "Sidecar connected"
      
      				on error
      
      					delay 0.5
      
      					say "Not found"
      
      				end try
      
      			end tell
      
      		end tell
      
      	end tell
      
      end tell
      
      delay 1
      
      beep 1
      
      -- Optional: Exit System Settings
      
      -- tell application "System Settings" to quit
      
    • iPad Name

      E45ECDB1-5987-44B4-A6D0-AA052F879FB2_1_201_a

  • Run the code
    • Permissions need to be enabled before running

      • System Settings → Privacy & Security → Accessibility → Turn on (Enable Sidecar, Automator)

        Screenshot 2025-06-06_15.53.05

    • Run the code and check if it takes effect

      Screenshot 2025-06-06_15.56.21

  • Save the code
    • Name: Enable Sidecar
  • Run Error
    • AppleScript “Enable Sidecar” does not allow accessibility access

      2025-01-22_07.15.41

    • Solution

iPad Operation Section#

↓ The detailed operation steps for iPad 9 are as follows

  • Click → Shortcuts → Click Add → Click Search on the right → ssh → Select Run Script Over SSH

  • Error when running ssh script

    🔔: Unable to connect to ssh remote server?

    • System Settings → General → Sharing → Turn on Remote Login

      Screenshot 2025-06-06_16.10.59

    • System Settings → Search: Shortcuts → Click: Advanced → Turn on: Allow Running Scripts

MacOS Create Virtual Screen#

🔔: When we unplug the display cable, we cannot enable Sidecar.

🔔: We trick the MacOS system by creating a virtual screen.

Effect Display#

  • Mac mini starts up, blindly typing the startup password, iPad one-click to enable Sidecar function
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.