How to Join a Mac to Active Directory via Terminal - JumpCloud (2024)

(Ed. Note:Although this tutorial walks you through the technical steps to bind Macs to AD, recent changes from Microsoft and Apple have made the tutorial below largely unnecessary, depending on how you have AD set up in your environment. In addition, the practice of binding Macs to AD has largely been deprecated in the field due to the ongoing administrative challenges inherent with the practice.

If you still find it necessary to manage Macs through AD in your environment, the steps below outline the process. However, you should consider using JumpCloud’s integration with AD and AAD as it solves this identity and access problem for you by centralizing communications between AD and your workforce; you can activate a free account today.)

This article continues our series on helpful commands for every Mac admin. The first article in the series explored how to enable SSH to access a remote Mac’s Shell securely while the second article examined how to change the computer name, hostname, and local hostname.

Jump to Tutorial

Active Directory (AD) provides crucial user and device management capabilities as an identity provider for IT systems. However, many IT admins find it challenging to manage Macs with Active Directory. Given that Active Directory is a sought-after identity and access management solution, IT admins must still face the challenge of integrating it effectively with macOS.

This article will examine how you can join a Mac to Active Directory services via the use of a command in the terminal app.

What Is a Directory Service and What Is Active Directory?

Directory Services

Before delving into Active Directory, it is critical to understand what directory services are all about. Simply put, directory services organize and manage users and IT resources within a network and enable administrators to granularly control user access to those IT resources. For instance, employees in the marketing department would have access to sales content but would be restricted from accessing financial information.

A directory can be defined as the ultimate source of truth used in verifying a user identity, and maintains information such as user ID, group membership, SSH keys, passwords, and other unique identifiers.

Directory services own the authentication and authorization process. They verify users’ identities (authentication) against the directory’s user database. If the specific access credentials provided match the credentials in the database, a user is granted access (authorization) to their respective IT resources. Otherwise, the user is denied access, which makes directory services a key cybersecurity tool.

Active Directory

Active Directory, a common identity provider, was developed by Microsoft. It pioneered the era of identity management at a time when the majority of IT infrastructure was Windows-based and managed on premises.

With AD in place, IT admins can connect users and/or groups to IT resources and control policies. The information stored in Active Directory includes users, groups, networks, digital assets, systems, and applications. It also defines the relationship between those entities.

How to Join a Mac to Active Directory via Terminal - JumpCloud (1)

Breaking Up with Active Directory

Don’t let your directory hold you back. Learn why it’s time to break up with AD.

Read Now

How to Join a Mac to Active Directory Services via Terminal

There are several ways to bind a Mac into Active Directory services. Methods include running a command in the terminal app, using Apple Directory Utility, or using a cloud identity bridge. In this section, we will explore how to connect Mac to Active Directory services using the terminal app.

  1. Launch the terminal app on your Macbook.

You can do this by searching “terminal” using the Spotlight search option on your computer or navigating through Applications > Utilities > Terminal.

  1. Enter and run the command.

You can use the dsconfigad command to bind a Mac to Active Directory via the terminal app. All you need to do is run the following command. Note that you need to replace the domain name, computer name, password, etc. with your specific information.

sudo dsconfigad -preferred <adserver.example.com> -a <computername> –domain example.com -u administrator -p <password>

The arguments in the command are explained as follows:

  • -a: This adds your computer to the Active Directory. Replace <computer-name> with your actual computer name.
  • -u: Specifies the admin username that has the rights to bind the Mac to AD. Replace <username> with your computer’s username.
  • -domain: States the domain name of the domain you want to join. Replace example.com with the domain you want to join.

After you have binded a Mac to the domain, you can also use dsconfigad to set the admin options in Directory Utility by running the command below:

sudo dsconfigad -alldomains enable -groups domain <[emailprotected]>, enterprise <[emailprotected]>

Using Mac’s Built-In Apple Directory Utility

One of the services in Apple Directory Utility is Active Directory Connector which generates all the necessary attributes for macOS authentication from AD user accounts. It also supports AD authentication policies like password changes, expirations, and security options. You can take the following steps to bind Mac to Active Directory using the utility.

Open User & Groups and Join the Network Account Server

  1. Navigate through System Preferences > User & Groups.
  2. Click the lock icon and provide your user password.
  3. Click Login Options (Figure 1).
  4. Next to Network Account Server, click Join (Figure 1).
How to Join a Mac to Active Directory via Terminal - JumpCloud (2)

Open the Directory Utility

A pop-up shown in Figure 2 will appear. Click Open Directory Utility as shown in Figure 2.

How to Join a Mac to Active Directory via Terminal - JumpCloud (3)

Connect to Active Directory

Type your Active Directory domain and click Bind (Figure 3).

How to Join a Mac to Active Directory via Terminal - JumpCloud (4)

Wrap Up

Binding a Mac to Active Directory enables macOS access to the legacy identity management solution. In this article, we have explored how you can join a Mac to AD services either through the terminal app or via the use of Apple Directory Utility.

Another option for a more seamless connection is to leverage a cloud identity bridge, i.e., a bridge that allows you to extend AD-bound identities to IT resources unable to directly bind to AD, such as Mac devices, Linux servers, remote Windows machines, and web applications.

While historically it was possible to layer together multiple point solutions to act as that bridge, today’s IT environments have become much more complex as the cloud has matured and remote work has gained prevalence. The JumpCloud Directory Platform was built to eliminate this complexity and empower modern IT admins to build connections between all of their IT resources with a single cloud-based console.

If you’re not ready to replace AD altogether, then JumpCloud’s Active Directory Integration could be the answer. This lightweight approach integrates with a cloud-hosted directory service that allows IT admins to have full user and device control over their Mac fleet, as well as Windows and Linux devices.

To learn more about what is possible with AD and JumpCloud, check out our whitepaper AD and JumpCloud: A Complete IAM Approach.

  • Best Practices
  • How-To
  • Devices
  • Integrations
How to Join a Mac to Active Directory via Terminal - JumpCloud (2024)

FAQs

How do I connect my Mac to Active Directory domain? ›

Bind using Directory Utility
  1. In the Directory Utility app on your Mac, click Services.
  2. Click the lock icon.
  3. Enter an administrator's user name and password, then click Modify Configuration (or use Touch ID).
  4. Select Active Directory, then click the “Edit settings for the selected service” button .

How to check if Mac is domain joined terminal? ›

Mac OS X
  1. Open the Directory Utility. 10.7 and above: In System Preferences, click Users and Groups, then click Login Options. ...
  2. If Active Directory is NOT checked, then your computer is not joined to an Active Directory. ...
  3. Look under the Active Directory Domain field for this entry:
Feb 24, 2015

How do I run a terminal command on a Mac? ›

Open Terminal

On your Mac, do one of the following: Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal. In the Finder , open the /Applications/Utilities folder, then double-click Terminal.

What is the Active Directory Connector on a Mac? ›

The Active Directory connector is listed in the Services pane of Directory Utility, and it generates all attributes required for macOS authentication from standard attributes in Active Directory user accounts.

How do I join Microsoft Active Directory on a Mac? ›

You can use the dsconfigad command in the Terminal app to bind a Mac to Active Directory. The native support for Active Directory includes options that you don't see in Directory Utility. To see these advanced options, use either the Directory payload in a configuration profile; or the dsconfigad command–line tool.

Can I manage Active Directory from a Mac? ›

Edit Active Directory user accounts and other records in Directory Utility on Mac. You can use Directory Editor to make changes to user accounts, group accounts, computer groups, and other records in an Active Directory domain. You can also use Directory Editor to delete records in an Active Directory domain.

How to join computer to domain from command line? ›

Open a Command Prompt window as an administrator. Type the command netdom join %computername% /domain:domainname /userd:username /passwordd:password and press Enter.

How do I ping a domain in Terminal Mac? ›

Mac or Apple:
  1. Open a Finder window in one of two ways: a. Click the blue and gray face icon in the dock; or b. Press the Command key and the A key at the same time.
  2. Open the Utilities folder.
  3. Open the Terminal app.
  4. Type "ping" followed by the destination — either an IP address or a domain name, then press Enter.
Sep 27, 2022

What is the command for directory in Terminal? ›

To open a directory in a terminal, you use the cd command to change your current directory. This essentially opens that folder and places you in it.

Is Mac terminal the same as command prompt? ›

The Terminal app is similar to the Command Prompt in Windows. To open it: In the Finder go to Applications > Utilities and double-click Terminal. Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal.

Is command line the same as terminal Mac? ›

Terminal is an app for advanced users and developers that lets you communicate with the Mac operating system using a command line interface (CLI).

How do I open a directory in Terminal Mac? ›

On your Mac, open a Finder window, then navigate to the folder you want to use. If you don't see the path bar at the bottom of the Finder window, choose View > Show Path Bar. Control-click the folder in the path bar, then do one of the following. Open a new window: Choose Open in Terminal.

What port is used to connect to Active Directory? ›

Active Directory (local security authority)
Application protocolProtocolPorts
Active Directory Web Services (ADWS)TCP9389
Active Directory Management Gateway ServiceTCP9389
Global CatalogTCP3269
Global CatalogTCP3268
9 more rows
Dec 26, 2023

What is Active Directory Connector? ›

What is an AD Connector? Active Directory Connector (ADC) is a gateway that receives Active Directory user updates and automatically makes the same changes within your account making user management easier and more efficient.

How do I connect my computer to a domain in Active Directory? ›

Navigate to System and Security, and then click System. Under Computer name, domain, and workgroup settings, click Change settings. Under the Computer Name tab, click Change. Under Member of, click Domain, type the name of the domain that you wish this computer to join, and then click OK.

How do I connect to an Active Directory domain? ›

Windows Server : join an Active Directory domain
  1. Verify that the server resolves the Active Directory domain using the ping command. ...
  2. Open the server manager. ...
  3. Open system properties. ...
  4. Edit system properties. ...
  5. Enter the Active Directory domain name. ...
  6. Enter credentials for a domain account.
Jul 15, 2020

How do I access my domain in Active Directory? ›

Select Start > Administrative Tools > Active Directory Users and Computers. In the Active Directory Users and Computers tree, find and select your domain name.

How do I connect to remote Active Directory? ›

Manually grant RDP access to an Active Directory user
  1. Log in to the server.
  2. Right-click the Windows® icon and select System.
  3. Select the remote settings depending on your Windows version: ...
  4. Click on Select Users.
  5. Click Add.
  6. Type the username you wish to add.
  7. Click Check Names. ...
  8. After you add the user, click Apply and OK.

Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 5926

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.