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.
@mikevic18
Copy link

You can just download the update through the App Store.

@wchadm
Copy link

wchadm commented Jul 14, 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

This method worked for me with a few tweaks. M2 running Ventura 13.4.1 For whatever reason, I was unsuccessful in changing the root password. Ended up creating a new user via command line and using that user to create the user in system preferences.

  1. Boot to Recovery (Hold down power button on M2.
  2. Open Terminal and create a new user using the below commands. Note that the volume name may vary. This example creates an admin user called "test"
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test UserShell /bin/bash
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test RealName "Lucius Q. User"
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test UniqueID "1010"
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test PrimaryGroupID 80
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test NFSHomeDirectory /Users/luser
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -append  /Local/Default//Groups/admin GroupMembership test
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/test
  1. Enter a new password for the user.
  2. Once complete click the Apple logo -> Reboot or in Terminal type Reboot then press Enter and let macOS start-up.
  3. Show the hidden menubar and go to System Settings when the Setup Assistant begins by pressing Command + Option + Control + T together.
  4. Click the Apple logo > System Settings -> Users & Groups
  5. 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 "test" and use the password you created earlier in Terminal.
  6. 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.
  7. Boot to Recovery again.
  8. Open Terminal and enter the command below and press Enter.
    touch /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone
  9. Then type Reboot and press Enter or force off your Mac again using the steps above.
  10. Enjoy your stolen laptop jk

Thank you for this - worked perfectly on 2023 M2 MBA 15"!

@samcoinhope
Copy link

I cant creat a root user in my ventura 13.4.1
Please help , it gives me error in the terminal ??

@joshworksit
Copy link

joshworksit commented Jul 15, 2023 via email

@samcoinhope
Copy link

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

This method worked for me with a few tweaks. M2 running Ventura 13.4.1 For whatever reason, I was unsuccessful in changing the root password. Ended up creating a new user via command line and using that user to create the user in system preferences.

  1. Boot to Recovery (Hold down power button on M2.
  2. Open Terminal and create a new user using the below commands. Note that the volume name may vary. This example creates an admin user called "test"
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test UserShell /bin/bash
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test RealName "Lucius Q. User"
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test UniqueID "1010"
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test PrimaryGroupID 80
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -create /Local/Default/Users/test NFSHomeDirectory /Users/luser
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -append  /Local/Default//Groups/admin GroupMembership test
dscl -f /Volumes/Macintosh\ HD\ -\ Data/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/test
  1. Enter a new password for the user.
  2. Once complete click the Apple logo -> Reboot or in Terminal type Reboot then press Enter and let macOS start-up.
  3. Show the hidden menubar and go to System Settings when the Setup Assistant begins by pressing Command + Option + Control + T together.
  4. Click the Apple logo > System Settings -> Users & Groups
  5. 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 "test" and use the password you created earlier in Terminal.
  6. 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.
  7. Boot to Recovery again.
  8. Open Terminal and enter the command below and press Enter.
    touch /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone
  9. Then type Reboot and press Enter or force off your Mac again using the steps above.
  10. Enjoy your stolen laptop jk

Thank you for this - worked perfectly on 2023 M2 MBA 15"!

is this steps work with the new update of ventura 13.4.1 ??

@joshworksit
Copy link

joshworksit commented Jul 15, 2023 via email

@bagofcig
Copy link

bagofcig commented Jul 17, 2023

@gboy13

The correct one should be this, it doesn't need \ -\ Data

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

Hi , i’m not able to do any command with the dscl -f in boot recovery.
I tried both commands the one with \ -/ ,,, and with out it. Please help me out
Error attached
Also, i tried the video link which you were referring but no luck passing the first one.
IMG_5201

@jeremylpro
Copy link

jeremylpro commented Jul 18, 2023

Will updating macOS change anything?

@joshworksit
Copy link

joshworksit commented Jul 18, 2023 via email

@tecnicalapple
Copy link

@gboy13
The correct one should be this, it doesn't need \ -\ Data

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

Hi , i’m not able to do any command with the dscl -f in boot recovery. I tried both commands the one with \ -/ ,,, and with out it. Please help me out Error attached Also, i tried the video link which you were referring but no luck passing the first one. IMG_5201

i'm with the same problema. Did u know hw to fix it? Please

@tecnicalapple
Copy link

someone can help mwith with the erro? Please

@tecnicalapple
Copy link

someone please

@tecnicalapple
Copy link

image
i'm with this erro too ;c

@joshworksit
Copy link

joshworksit commented Jul 21, 2023 via email

@IJRZI
Copy link

IJRZI commented Jul 23, 2023

@henrik242 really thanx in this way, it no more messages. Can I upgrade to os14 then?

@patrickcyi
Copy link

just FYI, if you are M1 and upgraded to Ventura. Here is how to bypass, 1. usb create monterey installer. 2. erase, install M, 3 unplug wifi at alomost done installation. 4. no wifi setup, 5. bypass MDM notif

@gordi415
Copy link

gordi415 commented Jul 23, 2023 via email

@patrickcyi
Copy link

@joshworksit
Copy link

joshworksit commented Jul 24, 2023 via email

@Ran-Xing
Copy link

Sonomo 23A5286i Failed to block notifications,And the configuration will automatically override

@IJRZI
Copy link

IJRZI commented Jul 26, 2023

The latest version?! omg?! Apple did fix it?!

@IJRZI
Copy link

IJRZI commented Jul 26, 2023

Sonomo 23A5286i Failed to block notifications,And the configuration will automatically override

Does masking linked servers by host work?

@ehsan58
Copy link

ehsan58 commented Jul 26, 2023

What's the difference between this method and bypass services like lpro, hfz and etc.
Could anyone tell me please?

@Ran-Xing
Copy link

@IJRZI No pop-up window after shielding hosts

@lihanchen
Copy link

For the 8 lines of code to create test user, we can just change the password of root by one command:
dscl -f /Volumes/Macintosh\ HD/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Default/Users/root
Then in the system settings, create user with root/password you set.

@bagofcig
Copy link

bagofcig commented Jul 28, 2023

First see if you can navigate to the exact folder you are using in the command, so first, if you just typed the command and just got that error then use this command, “cd /Volumes” and press Return.Did it go to that directory?If yes, then keep going into the sub folders.  To do this the next command would be “cd /Volumes/Macintosh HD” and press ReturnAgain, evaluate if you could get into the directory.  My thoughts are at some point you are not going to navigate well because the folders is called something else… let us know what you find!Sent from my iPhoneOn Jul 20, 2023, at 8:05 PM, mateusapple @.> wrote:Re: henrik242/Disable Device Enrollment Program (DEP) notification on macOS @. commented on this gist.i'm with this erro too ;c—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you commented on the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.

the issue that i counter is when i do the command in boot recovery i get the error that i posted earlier, but if do it when the devices booted regularly it works fine, also i can't choose a new password because it asked for the old password which is for the root user, attached
Screenshot 2023-07-28 at 7 41 09 PM

@joshworksit
Copy link

joshworksit commented Jul 28, 2023 via email

@bagofcig
Copy link

The command has to be run prior to setup completing, so on a fresh install. But you have to first start the Mac after an erase and reinstall, then let it get to the Welcome screen, then power it off and startup to recovery and perform the steps. IF you are already in the macOS logged into your user and you are getting the notification for MDM enrollment you can do this… Reboot to Recovery and open Terminal, enter the command “csrutil disable” then “restart” but hold the power button down so you can go right back into Recovery. Once in Recovery open Terminal again and navigate to /Volumes/Macintosh HD/var/db/ConfigurationProfiles and then delete the Settings and Store folders with the commands “rm -R settings”. “rm -R stores”. Then navigate to /Volumes/Macintosh HD/etc and edit the hosts file to add the following: 0.0.0.0 alfred.apple.com 0.0.0.0 iprofiles.apple.com http://iprofiles.apple.com/ Then save the file and issue “csrutil enable” then “restart”. All should be well now.

On Jul 28, 2023, at 12:42 PM, bagofcig @.***> wrote: @bagofcig commented on this gist. First see if you can navigate to the exact folder you are using in the command, so first, if you just typed the command and just got that error then use this command, “cd /Volumes” and press Return.Did it go to that directory?If yes, then keep going into the sub folders. To do this the next command would be “cd /Volumes/Macintosh HD” and press ReturnAgain, evaluate if you could get into the directory. My thoughts are at some point you are not going to navigate well because the folders is called something else… let us know what you find!Sent from my iPhoneOn Jul 20, 2023, at 8:05 PM, mateusapple @.> wrote:Re: henrik242/Disable Device Enrollment Program (DEP) notification on macOS @. commented on this gist.i'm with this erro too ;c—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you commented on the thread.Triage notifications on the go with GitHub Mobile for iOS or Android. the issue that i counter is when i do the command in boot recovery i get the error that i posted earlier, but if do it when the devices booted regularly it works fine, attached https://user-images.githubusercontent.com/130602159/256881050-3fa5b6c8-a0c0-47ee-86f1-00f2c112ebab.png — Reply to this email directly, view it on GitHub https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd#gistcomment-4644296 or unsubscribe https://github.com/notifications/unsubscribe-auth/ANIV4G2U3ZQY6UIUQDP5HZLXSPTWVBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTAMBRGYYTCMRSU52HE2LHM5SXFJTDOJSWC5DF. You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

I’m not able to do the command “csrutil disable”, attached.
So, i will try the first option once i erase and install the os, and keep you posted.
image

@joshworksit
Copy link

joshworksit commented Jul 28, 2023 via email

@bagofcig
Copy link

You need to Restart and try it again.

I tried couple more times but it did not work.

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