macOSで俺is誰になったときの脳筋的対処方法

俺です。

オシャレ戦士MacOSで困ったのでメモを残します。

# 解決したい課題

homebrewでパッケージインストール時に `sudo: unknown uid 501: who are you?` が発生し、パッケージのインストールができなくて生きるのがからい

```
➜  brew install gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2.sierra.bottle.1.tar.gz

curl: (6) Could not resolve host: homebrew.bintray.com
Error: Failed to download resource "gmp"
Download failed: https://homebrew.bintray.com/bottles/gmp-6.1.2.sierra.bottle.1.tar.gz
Warning: Bottle installation failed: building from source.
==> Using the sandbox
sudo: unknown uid 501: who are you?
2017-09-19 13:37 xcodebuild[20440] (FSEvents.framework) FSEventStreamStart: ERROR: FSEvents_connect() => (ipc/send) invalid destination port (268435459)
2017-09-19 13:37 xcodebuild[20440] (FSEvents.framework) FSEventStreamInvalidate(): failed assertion 'streamRef != NULL'

2017-09-19 13:37 xcodebuild[20440] (FSEvents.framework) FSEventStreamRelease(): failed assertion 'streamRef != NULL'

Invalid connection: com.apple.coresymbolicationd
2017-09-19 13:37:34.297 xcodebuild[20440:1888958]  DVTFilePathFSEvents: Failed to start fs event stream.
2017-09-19 13:37:34.529 xcodebuild[20440:1888956] [MT] DVTAssertions: ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-12154/DVTFoundation/DeveloperStructure/DVTDeveloperPaths.m:666
Details:  Failed to get length of DARWIN_USER_CACHE_DIR from confstr(3), error = Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error"
Object:   <IDEDeveloperPaths: 0x7fa072421010>
Method:   -cacheDirectoryWithOptions:
Thread:   <NSThread: 0x7fa0725044d0>{number = 1, name = main}
Hints:

Backtrace:
  0   -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
  1   _DVTAssertionHandler (in DVTFoundation)
  2   _DVTAssertionFailureHandler (in DVTFoundation)
  3   __47-[DVTDeveloperPaths cacheDirectoryWithOptions:]_block_invoke_2 (in DVTFoundation)
  4   __47-[DVTDeveloperPaths cacheDirectoryWithOptions:]_block_invoke (in DVTFoundation)
  5   _dispatch_client_callout (in libdispatch.dylib)
  6   dispatch_once_f (in libdispatch.dylib)
  7   -[DVTDeveloperPaths cacheDirectoryWithOptions:] (in DVTFoundation)
  8   -[DVTPlugInManager _applicationCachesPath] (in DVTFoundation)
  9   -[DVTPlugInManager _plugInCachePath] (in DVTFoundation)
 10   -[DVTPlugInManager _loadPlugInCache:] (in DVTFoundation)
 11   -[DVTPlugInManager _scanForPlugIns:] (in DVTFoundation)
 12   IDEInitialize (in IDEFoundation)
 13   -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
 14  0x00000001055772af (in xcodebuild)
 15   start (in libdyld.dylib)
sh: line 1: 20442 Abort trap: 6           /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH


Error: gmp cannot be built with any available compilers.
Install GNU's GCC
  brew install gcc
```

# 解決方法

OSを再起動する

- 再起動前

俺is誰...

```
➜  ~/ id
uid=501(★ここにユーザ名の表記がない) gid=20(staff)
```

- 再起動後

俺is俺になりました

```
➜  ~/ id
uid=501(ore) gid=20(staff) 
```

homebrewでパッケージもインストールできました

```
➜  ~/ brew install gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2.sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring gmp-6.1.2.sierra.bottle.1.tar.gz
🍺  /usr/local/Cellar/gmp/6.1.2: 18 files, 3.1MB
```


おわり