manuelmagic9

Q: Where does OS X get the $HOSTNAME from?

Hi,

I bought a MacBook from a friend. I then changed the old HD with a new SSD and the RAM as well.

 

I made an USB Key with OS X El Capitan installer from my old MacBook Pro running Mac OS X 10.6 Snow Leopard and then I installed El Capitain on the MacBook. I made a fresh installation and I didn't restore any data from Time Machine etc.

 

In System Preferences / Sharing I see as computer name "Manuel's MacBook" and I read "Computers on your local network can access your computer at: ManuelsMacBook.local"

 

BUT

 

If I open a terminal the prompt says "MyFriendName-MacBook:~ Manuel"

 

How is this possible? Where does OS X get the hostname of my MacBook from?

 

I attach the output of the following commands, hoping can be useful to someone that will answer my question:

MyFriendName-MacBook:~ Manuel$ echo $HOSTNAME

MyFriendName-MacBook

MyFriendName-MacBook:~ Manuel$ hostname

MyFriendName-MacBook

MacBook, OS X El Capitan (10.11.3), null

Posted on Jan 31, 2016 4:39 AM

Close

Q: Where does OS X get the $HOSTNAME from?

  • All replies
  • Helpful answers

  • by greg sahli,

    greg sahli greg sahli Jan 31, 2016 4:51 AM in response to manuelmagic9
    Level 7 (25,400 points)
    Jan 31, 2016 4:51 AM in response to manuelmagic9

    System Preferences - Sharing

  • by manuelmagic9,

    manuelmagic9 manuelmagic9 Jan 31, 2016 5:00 AM in response to greg sahli
    Level 1 (0 points)
    Jan 31, 2016 5:00 AM in response to greg sahli

    Hi Greg,

    I'm sorry, but as you can read in my original post, the system preferences / sharing, there is a different string (the correct one).

  • by Esquared,

    Esquared Esquared Jan 31, 2016 5:04 AM in response to manuelmagic9
    Level 6 (8,518 points)
    Mac OS X
    Jan 31, 2016 5:04 AM in response to manuelmagic9

    The Macbook is probably still registered on your friend's name. See this info for some background: What to do before selling or giving away your Mac - Apple Support

  • by manuelmagic9,

    manuelmagic9 manuelmagic9 Jan 31, 2016 5:10 AM in response to Esquared
    Level 1 (0 points)
    Jan 31, 2016 5:10 AM in response to Esquared

    Hi Esquared,

    I'll ask him to check on supportprofile.apple.com but still... this means OS X has downloaded from somewhere since I changed the HDD with a new SSD.

  • by Linc Davis,

    Linc Davis Linc Davis Jan 31, 2016 8:19 AM in response to manuelmagic9
    Level 10 (208,037 points)
    Applications
    Jan 31, 2016 8:19 AM in response to manuelmagic9

    Before acquiring a second-hand computer, you should have run Apple Diagnostics or the Apple Hardware Test, whichever is applicable.

    The first thing to do after acquiring the computer is to erase the internal drive and install a clean copy of OS X. You—not the original owner—must do that. Changes made by Apple over the years have made this seemingly straightforward task very complex.

    How you go about it depends on the model, and on whether you already own another Mac. If you're not sure of the model, enter the serial number on this page. Then find the model on this page to see what OS version was originally installed.

    It's unsafe, and may be unlawful, to use a computer with software installed by a previous owner.

    1. If you don't own another Mac

    a. If the machine shipped with OS X 10.4 or 10.5, you need a boxed and shrink-wrapped retail Snow Leopard (OS X 10.6) installation disc from the Apple Store or a reputable reseller—not from eBay or anything of the kind. If the machine is very old and has less than 1 GB of memory, you'll need to add more in order to install 10.6. Preferably, install as much memory as it can take, according to the technical specifications.

    b. If the machine shipped with OS X 10.6, you need the installation media that came with it: gray installation discs, or a USB flash drive for a MacBook Air. You should have received the media from the original owner, but if you didn't, order replacements from Apple. A retail disc, or the gray discs from another model, will not work.

    To start up from an optical disc or a flash drive, insert it, then restart the computer and hold down the C key at the startup chime. Release the key when you see the gray Apple logo on the screen.

    c. If the machine shipped with OS X 10.7 or later, you don't need media. It should start up in Internet Recovery mode when you hold down the key combination option-command-R at the startup chime. Release the keys when you see a spinning globe. Note that Mac Pro tower models older than late 2014 (with the "cheese-grater" enclosure) cannot use Internet Recovery, regardless of which OS version they shipped with. The round Mac Pro (2014 or later) can use it.

    d. Some 2010-2011 models shipped with OS X 10.6 and received a firmware update after 10.7 was released, enabling them to use Internet Recovery. If you have one of those models, you can't reinstall 10.6 even from the original media, and Internet Recovery will not work either without the original owner's Apple ID. In that case, contact Apple Support, or take the machine to an Apple Store or another authorized service provider to have the OS installed.

    2. If you do own another Mac

    If you already own another Mac that was upgraded in the App Store to the version of OS X that you want to install, and if the new Mac is compatible with it, then you can install it. Use Recovery Disk Assistant to prepare a USB device, then start up the new Mac from it by holding down the C key at the startup chime. Alternatively, if you have a Time Machine backup of OS X 10.7.3 or later on an external hard drive (not a Time Capsule or other network device), you can start from that by holding down the option key and selecting it from the row of icons that appears. Note that if your other Mac was never upgraded in the App Store, you can't use this method.

    3. Partition and install OS X

    a. If you see a lock screen when trying to start up from installation media or in Recovery mode, then a firmware password was set by the previous owner, or the machine was remotely locked via iCloud. You'll either have to contact the owner or take the machine to an Apple Store or another service provider to be unlocked. You may be asked for proof of ownership.

    b. Launch Disk Utility and select the icon of the internal drive—not any of the volume icons nested beneath it. In the  Partition tab, select the default options: a GUID partition table with one data volume in Mac OS Extended (Journaled) format. This operation will permanently remove all existing data on the drive.

    c. An unusual problem may arise if all the following conditions apply:

              OS X 10.7 or later was installed by the previous owner

              The startup volume was encrypted with FileVault

              You're booted in Recovery mode (that is, not from a 10.6 installation disc)

    In that case, you won't be able to unlock the volume or partition the drive without the FileVault password. Ask for guidance or see this ASC discussion.

    d. After partitioning, quit Disk Utility and run the OS X Installer. If you're installing a version of OS X acquired from the App Store, you will need the Apple ID and password that you used. When the installation is done, the system will automatically restart into the Setup Assistant, which will prompt you to transfer the data from another Mac, its backups, or from a Windows computer. If you have any data to transfer, this is usually the best time to do it.

    e. Run Software Update and install all available system updates from Apple. To upgrade to a major version of OS X newer than 10.6, get it from the Mac App Store. Note that you can't keep an upgraded version that was installed by the original owner. He or she can't legally transfer it to you, and without the Apple ID you won't be able to update it in Software Update or reinstall, if that becomes necessary. The same goes for any App Store products that the previous owner installed—you have to repurchase them.

    4. Other issues

    a. If the original owner "accepted" the bundled iLife applications (iPhoto, iMovie, and Garage Band) in the App Store so that he or she could update them, then they're irrevocably linked to that Apple ID and you won't be able to download them without buying them. Reportedly, Mac App Store Customer Service has sometimes issued redemption codes for these apps to second owners who asked.

    b. If the previous owner didn't deauthorize the computer in the iTunes Store under his Apple ID, you wont be able to  authorize it immediately under your ID. In that case, you'll either have to wait up to 90 days or contact iTunes Support.

    c. When trying to create a new iCloud account, you might get a failure message: "Account limit reached." Apple imposes a lifetime limit of three iCloud account setups per device. Erasing the device does not reset the limit. You can still use an iCloud account that was created on another device, but you won't be able to create a new one. Contact iCloud Support for more information. The setup limit doesn't apply to Apple ID accounts used for other services, such as the iTunes and Mac App Stores, or iMessage. You can create as many of those accounts as you like.

  • by manuelmagic9,

    manuelmagic9 manuelmagic9 Jan 31, 2016 11:48 AM in response to Linc Davis
    Level 1 (0 points)
    Jan 31, 2016 11:48 AM in response to Linc Davis

    Hi Linc Davis,

    Thank you for your reply... but I fail to understand how this answer to my question. I clearly stated that I installed a new SSD.

  • by Linc Davis,Solvedanswer

    Linc Davis Linc Davis Jan 31, 2016 12:03 PM in response to manuelmagic9
    Level 10 (208,037 points)
    Applications
    Jan 31, 2016 12:03 PM in response to manuelmagic9
    sudo scutil --set HostName whatever-you-want

    If that doesn't work, the hostname is being set to the result of a reverse lookup of your IP address on a local DNS server, most likely your gateway.

  • by manuelmagic9,

    manuelmagic9 manuelmagic9 Feb 1, 2016 6:04 AM in response to Linc Davis
    Level 1 (0 points)
    Feb 1, 2016 6:04 AM in response to Linc Davis

    Thank you, I modified the hostname and after a reboot it is still the same.

    I still wonder where the old hostname was taken...