SIngle User Commands

Discussion in 'Mac Basics and Help' started by zerox169, Apr 27, 2017.

  1. zerox169 macrumors newbie


    Apr 27, 2017
    so my mac book crashed while shutting down and it compromised the boot table partition and can't be repaired. I've been reading up on single user mode and managed to access the directory/folder all my work is in. but that's as far as I've been able to get.

    in windblows you type /dir to view the contents of a directory/folder. How do you do it in mac? Additionally, what other commands are usable? I'm only interested in getting files from this folder, my one drive, and my downloads folder, could careless about the rest of the drive, but years of work are located in those folder and foolishly i haven't made any recent backups.

    All help is appreciated.
  2. KALLT macrumors 601

    Sep 23, 2008
    Try repairing the disk or reinstalling macOS (without formatting) from Recovery by holding down command + R at boot.
  3. 960design macrumors 68030

    Apr 17, 2012
    Destin, FL
    Mac uses traditional unix command for the most part.
    ls = will display contents of folder
  4. Fishrrman macrumors G5


    Feb 20, 2009
    What year and model is your MacBook?
    If it's so equipped, can you get it into Target Disk Mode?

    As mentioned above, can you boot into internet recovery mode?
  5. kschendel macrumors 6502a

    Dec 9, 2014
    I wouldn't be in a rush to perform any repair or recovery operations on the drive until you've tried other ways to get the data off. Target Disk mode is a good idea. Another thought is that assuming your macbook can boot from USB, make a bootable USB stick and boot from there. If you can access a directory at all, it suggests that the partition table and filesystem are both OK, so maybe what got trashed was the bootloader or something that booting depends on. If you can boot multiuser from a USB stick, and successfully mount the internal drive by hand (mount command), there are various ways you can proceed. You can scp stuff to another machine, or you can tar the important stuff onto your bootable medium or another USB stick / drive, etc.
  6. zerox169 thread starter macrumors newbie


    Apr 27, 2017
    All ready attempted that, it told me could not be repaired, and unable to install partition must be formatted

    I've typed that command and it says "command not found" something else i need to add or something?

    Late 2009 Mack Book Pro 15in I believe might be 13in, mostly use it for writing and bills paying when on vacation. Current os is Maverick, haven't had any problems till now.

    I could probably get into targeted disk mode since everything else is working, but i don't have the appropriate cable to connect my macs, no fire wire or thunderbolt cables.

    I've tried bootable USBs in the past with not much success, not sure if its something to do with the mac or something I'm doing wrong.


    I havent tired internet recovery but I need to read up on how it functions before proceeding.

    Thank you all again for your assistance.
  7. KALLT macrumors 601

    Sep 23, 2008
    That MacBook has no Internet Recovery. You’ll need the installation DVD that came with the MacBook, unless you have an installer thumb drive ready.

    I suggest you get an external drive and clone (‘recover’) your Macintosh HD partition onto it using Recovery’s Disk Utility. Then you wipe the drive, reinstall macOS and attempt to import your data from the external drive during the setup. I highly recommend not poking around in single-user mode, especially since you seem to be inexperienced. You have complete control in that mode and can destroy data with one mistyped command.
  8. MacUser2525 macrumors 68000


    Mar 17, 2007
    The path environment may not be set properly try an absolute path to it /bin/ls and any other commands user or use this in the Terminal to set it to be useful PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH". You can use echo $PATH in the Terminal first to check if those are already listed if so then there is problem accessing data on the drive.

    which ls
    The which command if it is working may help you if it is not finding the commands correctly. Now you are saying single user mode you are in have you done the mount / rw it suggests when entering that mode on boot plus the fsck it recommends doing on the volume it tells you to do as well? Also it should be possible if you get access to the drive contents to list the files that you can simply attach a USB drive and copy the files off the internal to the external.
  9. zerox169 thread starter macrumors newbie


    Apr 27, 2017
    The bin worked. And yes I've done the mount / rw + fsck. Whatever is wrong with the partition information can't be fixed.

    Thanks Sat but I read that article before coming here.

    Again, appreciate all the help.
  10. kschendel macrumors 6502a

    Dec 9, 2014
    If you got /bin/ls to work, do you see the data / files you want to preserve? I'd say the goal would be to copy them to someplace else, like a USB stick or drive, and then you can just wipe the internal drive and reinstall.

    You can figure out the commands you have to work with thusly:
    /bin/ls /bin
    /bin/ls /sbin
    /bin/ls /usr/bin

    I'd expect /bin and /sbin to be available in singleuser. /usr/bin, maybe and maybe not. If you have an external USB drive already formatted (with a Mac filesystem hfs), plug it in and try:
    /sbin/mount -t hfs /dev/disk2s2 /mnt
    it might take a bit of fiddling around to discover the proper /dev/diskNNN thing to put in; after you insert the USB drive try /bin/ls /dev/disk* and that might help. (Just saying /sbin/mount will tell you what your boot drive is, so it won't be that one.)

    Once you get something mounted that you can write to, cp off your data:
    /bin/mkdir /mnt/mystuff
    /bin/cp -R /your/directory /mnt/mystuff
    /sbin/umount /mnt

    I haven't used singleuser on a Mac for ages but the above ought to be going in the right direction, at least.

    If you have an external USB that's PC / msdos formatted, the -t argument to mount needs to reflect the filesystem type. It will be one of msdos (FAT), exfat, or ntfs.

    Don't do anything irreversible to the internal drive until you've verified that you got your files, they are all there, and actually contain what you thought what you were saving!
  11. KALLT macrumors 601

    Sep 23, 2008
    Seriously, don’t mess around in single-user mode. You should take the safe route and get the data off the drive using the methods described above (Recovery → cloning or target-disk mode).
  12. elf69 macrumors 68020


    Jun 2, 2016
    Cornwall UK
    Could you get a USB HDD caddy and pop HDD out and connect to another mac to get data back?
  13. kschendel macrumors 6502a

    Dec 9, 2014
    I don't disagree with KALLT that avoiding single user mode is preferable. I had the impression that single-user was the only route that was working for the OP. If recovery mode works and can access the files, or if OP can buy/beg/borrow a firewire cable for TDM, I'd agree with trying those first.
  14. satcomer macrumors 603


    Feb 19, 2008
    The Finger Lakes Region
    So you don't want to try to repair a disk with FSCK you just want to hack a Mac!
  15. zerox169 thread starter macrumors newbie


    Apr 27, 2017
    really apperciat
    Sat I've stated 3 times, i've tired that approach and it doesn't work, you even quoted it. Whatever is wrong with the drive's partition, it can't be fixed.
    --- Post Merged, Apr 29, 2017 ---
    Again, thank you everyone for you assistance. My goal with single user has just been to navigate and see if the files are intact, and if absolutely necessary, try and use it to copy the files as a last resort. Waiting on a thunderbolt cable to come since they are all sold out in my area, not much demand for that here limited carriers.
  16. Fishrrman macrumors G5


    Feb 20, 2009

    IF you have a second Mac, and
    IF it has firewire or thunderbolt,
    You MIGHT be able to boot the MacBook into "target disk mode", and then connect to the other Mac.

    Do this, and you can mount and access the internal drive (of the MacBook) on your other Mac, as if it were an ordinary external drive.

    IF the drive mounts, the next thing you'll need to do is this:
    1. Click ONE time on the drive icon to select it
    2. Type command-i (eye) to bring up the "get info" box
    3. Toward the bottom of the box there is a "sharing and permissions" area. If you don't see it, click the disclosure arrow to reveal it.
    4. Click the lock icon and enter your password
    5. Now, put a check into the box "ignore ownership on this volume"
    6. Close the get info box

    WHY you did the above:
    This action lets you access the MacBook drive and go anywhere you wish without encountering permissions/ownership problems.

    Are you able to locate and access the files you're looking for?
    If so, COPY THEM SOMEWHERE ELSE, just to get a second copy available.

    Can you get this far?
    If so, let us know what happens.
  17. zerox169 thread starter macrumors newbie


    Apr 27, 2017
    HORRAY! I didn't think it was going to work, took 10 minutes to mount the drive, gave me "OSmac can not be repaired, however you may navigate and copy files from the drive."

    Thanks for your help everyone really appreciated it.

Share This Page