csrutil disable
Restart computer
In the terminal, type
sudo open /Applications/TextEdit.app /System/Library/LaunchDaemons/com.apple.ManagedClient.enroll.plist
change
<key>com.apple.ManagedClient.enroll</key>
<true/>
to
<key>com.apple.ManagedClient.enroll</key>
<false/>
So that the changes take effect
When I blocked the list below of apple URLs in the hosts file, my machine was unable to connect to iMessage or FaceTime. I would receive an error message of "unexpected error" when trying to log in with my apple account to iMessage, and "cannot send message iMessage needs to be enabled to send this message" when trying send a message. When I removed albert.apple.com from the hosts file, but kept the other sites, both iMessage and FaceTime activated and functioned properly.