Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henrik242/65d26a7deca30bdb9828e183809690bd to your computer and use it in GitHub Desktop.
Save henrik242/65d26a7deca30bdb9828e183809690bd to your computer and use it in GitHub Desktop.
@joshworksit
Copy link

joshworksit commented Mar 7, 2023

thanks @gwshaw for the edits!

Here is how you can bypass MDM completely ...

Boot to Recovery

Open Terminal and enable the root user and give it a password:

Enter the command below and press Enter

dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/root

There might be a slight directory difference between Intel/Silicon. If the command above does not work try using one of these variations:

/Volumes/Macintosh\ HD\ -\ Data/ or /Volumes/Data/

Enter a new password for root user. Note * If you choose a simple password be aware that the root user will be available as a user that can log into macOS which could present a risk to the security of the device.

Once complete click the Apple logo -> Reboot or in Terminal type Reboot then press Enter and let macOS start-up.

Show the hidden menubar and go to System Settings when the Setup Assistant begins by pressing Command + Option + Control + T together.

Click the Apple logo > System Settings -> Users & Groups

Create an admin user with your username and password then click Add Account. The authentication window will appear and autofill the username as user "System Setup". Change this to "root" and use the password you created earlier in Terminal.

Use the Apple menu and select Reboot and if this does not work, force off your Mac by holding the power button down at least 10 seconds.

Boot to Recovery again.

Open Terminal and enter the command below and press Enter.

touch /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone

Then type Reboot and press Enter or force off your Mac again using the steps above.

If you found this helpful please donate! https://pay.siliconbypass.com

@duyjack
Copy link

duyjack commented Mar 9, 2023

Here is how you can bypass MDM completely ...

Boot to Recovery Open Terminal execute "dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/root"

Reboot then...

Step through the Welcome and Setup screens At MDM enrollment (or Remote Management) it should prompt to login at some point for MDM - if not go to the Alternate step Highlight any text -> secondary (right) click -> Search Google Safari will open then go to the next step (skip Alternate)

Alternate: if no text to select then try pressing Command & Option & Control & T at the same time to force Terminal open.

Click the Apple logo System Preferences Users & Groups Create your admin user using the Root credentials previously set in recovery with the "dscl" command

Reboot and Boot to Recovery

Use Terminal and execute "touch /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone"

Reboot, Enjoy!

If you found this helpful please donate! https://pay.siliconbypass.com

Did you try it?

@gwshaw
Copy link

gwshaw commented Mar 11, 2023

Here is how you can bypass MDM completely ...

Boot to Recovery Open Terminal execute "dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/root"

Reboot then...

Step through the Welcome and Setup screens At MDM enrollment (or Remote Management) it should prompt to login at some point for MDM - if not go to the Alternate step Highlight any text -> secondary (right) click -> Search Google Safari will open then go to the next step (skip Alternate)

Alternate: if no text to select then try pressing Command & Option & Control & T at the same time to force Terminal open.

Click the Apple logo System Preferences Users & Groups Create your admin user using the Root credentials previously set in recovery with the "dscl" command

Reboot and Boot to Recovery

Use Terminal and execute "touch /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone"

Reboot, Enjoy!

If you found this helpful please donate! https://pay.siliconbypass.com

@joshworksit !!! Works nicely, with a minor correction. No quotes on either of the command lines. With the quotes, the escaped spaces are treated literally so the paths are then broken, at least in Ventura recovery terminal. Spaces are not on the allowed double-quoted string pass-through escapes for Bash. I literally spent days drowning in comments and variations that did not work before I just skipped to the end and found this. This took only minutes once corrected.

A few notes for the less adept:

  • I started with an erased SSD and installed Ventura from recovery and let it boot up to the country select screen
  • I didn't have a network connected after the boot up, but I don't think that mattered.
  • rather than risking anything by progressing up to the MDM in setup, I just went straight to the Alternate to launch a terminal to get the Apple logo to get to system settings
  • in Ventura it is "System Settings" rather than "System Preferences"
  • then Users & Groups
  • then Add Account. The authentication comes up as user "System Setup". Change this to "root" and use the password you created.
  • the various "restart" and "shutdown" options didn't want to participate in the rouse, so use the power off button for the "Reboot and Boot to Recovery Step"

I'd also guess that after completing this the user root password should be removed, but I haven't done that. Otherwise someone can log into user root at the login screen (Shows as "Other..."). Is this the case @joshworksit ?

@sire901
Copy link

sire901 commented Mar 16, 2023

hi im using mbp m1 monterey and im new at this how do i bypass mdm pop up without fresh install ?

@lucasmenares
Copy link

hi im using mbp m1 monterey and im new at this how do i bypass mdm pop up without fresh install ?

follow the instructions of my gist: https://gist.github.com/lucasmenares/e3dfe5d76a0ad24663d88102cb4dde3d

@nomdmplz
Copy link

Currently have a 2023 macbook pro with the m2max with mdm currently cant get passed activation screen mac os venture fmm is off anything on this platform?

@joshworksit
Copy link

Specs don’t really matter…OS version is most important. Follow the steps exactly and it will work.

@albzoon
Copy link

albzoon commented Mar 25, 2023

Restored M1 Macbook with DFU Mode and when all is done shows me up the setup screen with no option for "no internet connection" suppose that is already enrolled by dfu restore that never happened before..
Anyway to bypass at this point with no option for creating a user and blocking on terminal required hosts??

@joshworksit
Copy link

Follow the steps I posted above and you can bypass the MDM with no need to select No Internet Connection - which is no longer an option during setup - an internet connection is required from what I understand it is part of the activation process similar to an iPhone requiring a data connection to activate at first turn on...but you can enable root user using terminal in Recovery and just follow the steps I posted above to get access to the macOS and bypass setup entirely..

@albzoon
Copy link

albzoon commented Mar 25, 2023

opened in terminal at the recovery screen, did this command.. dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/root
but it says: Not a known DirStatus..

@joshworksit
Copy link

So you might not be in the right Recovery environment. I think you need to try shutting down fully, or if you did that and started up to recovery and got that message, try simply starting up the Mac fully and then go to the Apple menu and Restart to Recovery without fully shutting down the Mac. OR your volume name is not Macintosh HD - you can look at Disk Utilty to see what the volume name of your Mac HD is ...

@kernatron
Copy link

kernatron commented Mar 25, 2023

@joshworksit I really appreciate everything you've shared so far. When creating a new password in terminal, it's asking me for the old password - which I don't know. Any ideas why it's asking for that? Should it be asking for anything at that point?

Am I better deleting the partition and reinstalling Ventura at this point? Thanks!

Edit: Okay, so I managed to do all of the above, but I'm still getting the MDM screen appearing. Gah, I thought I'd got it!

@joshworksit
Copy link

Yes if it is asking for an old password you never set, simply erase Macintosh HD, and reinstall the OS and then you'll know exactly where every component is at and what to expect.

@albzoon
Copy link

albzoon commented Mar 27, 2023

I tryed on the recovery environment also on first step of setup after the restore from dfu that the volume name is by default Macintosh HD
and still 'not a known dir status'
I put the command with spaces as u described and still not a known dir status.. if u want i can send u photos from my procces.
PLS Help with this situation
I appreciate this

@albzoon
Copy link

albzoon commented Mar 27, 2023

@cadriel
Copy link

cadriel commented Mar 28, 2023

Can someone confirm the list of domains that should be blocked after completing the initial install steps, that prevent re-enrollment and notifications - but allow automated updates (if this is even possible..)?

I have a Ventura install - and block the following domains;

*.gdmf.apple.com
*.acmdm.apple.com
*.albert.apple.com
*.deviceenrollment.apple.com
*.mdmenrollment.apple.com
*.iprofiles.apple.com

But i'm wondering if I can perhaps allow albert and gdmf among others so automated updates will work again, without any negative impact.

@kevmmdev
Copy link

image

I updated to the latest ventura 13.3, coming from 13.1. So far so good. All I have to do was go to the app store, search ventura and download. This will only install the update. It will take some time

@cadriel
Copy link

cadriel commented Mar 28, 2023

Yes, I understand manual updates work - and have done this. I however would like to know if we can re-enable automatic updates.

@Nisounas
Copy link

Nisounas commented Mar 28, 2023

I got scammed I bought a 2020 M1 MBP under MDM/DEP program,
I updated it to ventura (13.2.1) and I found out that it has a lot of stability problems
I want to format it to fix the stability problem, is there any way to format it safely without it being blocked,

Note: I blocked all these links in my wifi settings
Screenshot_7

after I didn't receive any notification from DEP/MDM program, when I run this command :
sudo profiles show -type enrollment
I get this error message:
Error fetching Device Enrollment configuration: (34000) Error Domain=MCCloudConfigurationErrorDomain Code=34000 "The device failed to request configuration from the cloud." UserInfo={NSLocalizedDescription=The device failed to request configuration from the cloud, CloudConfigurationErrorType=CloudConfigurationFatalError}

@gwshaw
Copy link

gwshaw commented Mar 31, 2023

The root user already exists. You are only assigning a password. I typed the new password at the end of the dscl command line.

@rbt19
Copy link

rbt19 commented Mar 31, 2023

The root user already exists. You are only assigning a password. I typed the new password at the end of the dscl command line.

Thank you for your reply! I was finally able to figure out. The problem is the this section of the code: /Volumes/Macintosh\ HD\ -\ Data/
That one works only with intel macs, for silicon the correct code is: /Volumes/Data/
Thanks for sharing these information. I am extremely grateful.

@Gius29
Copy link

Gius29 commented Apr 1, 2023

I have disabled MDM following the instructions.
Can I sign-in with my Apple ID (iCloud)? Does this allow to detect my device?

@joshworksit
Copy link

Use your Apple ID as you wish, one has nothing to do with the other so it will not affect any iCloud services.

@joshworksit
Copy link

The root user already exists. You are only assigning a password. I typed the new password at the end of the dscl command line.

Thank you for your reply! I was finally able to figure out. The problem is the this section of the code: /Volumes/Macintosh\ HD\ -\ Data/ That one works only with intel macs, for silicon the correct code is: /Volumes/Data/ Thanks for sharing these information. I am extremely grateful.

Thanks for catching this difference I'll add it to my original post!

@JZFeng
Copy link

JZFeng commented Apr 2, 2023

The root user already exists. You are only assigning a password. I typed the new password at the end of the dscl command line.

Thank you for your reply! I was finally able to figure out. The problem is the this section of the code: /Volumes/Macintosh\ HD\ -\ Data/ That one works only with intel macs, for silicon the correct code is: /Volumes/Data/ Thanks for sharing these information. I am extremely grateful.

Thanks for catching this difference I'll add it to my original post!

So what is the correct final full command for Apple Silicon?
Is it this one "dscl -f  /Volumes/Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/root" ?

@nambh83
Copy link

nambh83 commented Apr 4, 2023

My MBP M1 bypass MDM completely on MacOS 11.6. Can I upgrade to MacOS 13.3 via Setting? Do I need to bypass MDM again after upgrade?
Thanks.

@alucardness
Copy link

My MBP M1 bypass MDM completely on MacOS 11.6. Can I upgrade to MacOS 13.3 via Setting? Do I need to bypass MDM again after upgrade? Thanks.

Update, it's already bypassed, so you don't have to do it again.

@nambh83
Copy link

nambh83 commented Apr 4, 2023

My MBP M1 bypass MDM completely on MacOS 11.6. Can I upgrade to MacOS 13.3 via Setting? Do I need to bypass MDM again after upgrade? Thanks.

Update, it's already bypassed, so you don't have to do it again.

Really??? Thank you. I will try. :)

@albzoon
Copy link

albzoon commented Apr 4, 2023

Cant bypass mdm on macbook m1 because when its recovered from dfu mode it install automatically ventura and also check on the profile server so the mdm enrollment catches at the beggining..
ANY HELP for bypass mdm to these models

@Aooga776
Copy link

Aooga776 commented Apr 6, 2023

Thanks for all the info @joshworksit I've run into one snag which is bypassing setup assistant. I followed this line:

Open Terminal and enter the command below and press Enter.

touch /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone

Then type Reboot and press Enter or force off your Mac again using the steps above.

and I get:

touch: /Volumes/Macintosh HD/: Read-only file system
touch: - Data/private/var/db/.AppleSetupDone: No such file or directory

So I'm stuck here and can't figure out any way to bypass the setup assistant. Everything else worked flawlessly. Please let me know if you have any idea what I'm doing wrong here. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment