# Can't enroll MacOS agent

**URL:** <https://discuss.elastic.co/t/cant-enroll-macos-agent/283601>\
**Category:** Endpoint Security\
**Tags:** fleet\
**Created:** [September 8, 2021, 3:57am UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601 "2021-09-08T03:57:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hilt86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilt86/32/20308_2.png) [@hilt86](https://discuss.elastic.co/u/hilt86)\
**Post date:** [September 8, 2021, 3:57am UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/1 "2021-09-08T03:57:56Z")

</div>

Me again..I'm trying to enroll a macOS agent and when I run the enroll command I get the following :

```auto
Error: fail to enroll: fail to execute request to fleet-server: fail to decode enrollment response: context canceled
Error: enroll command failed with exit code: 1

```

I've tried enrolling on multiple installs (7.14.1 and 7.14.0) with the same issue...

It seems to contact the fleet server but it leaves it in a state of updating :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e2c1d920e90a5a550b39fb0ae7629685c92ca37e.png)

---

<div class="post-metadata">

**Author:** ![blaker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blaker/32/65621_2.png) [@blaker](https://discuss.elastic.co/u/blaker)\
**Post date:** [September 8, 2021, 6:24pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/2 "2021-09-08T18:24:26Z")

</div>

Can you please provide the command you are using to enroll?

---

<div class="post-metadata">

**Author:** ![hilt86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilt86/32/20308_2.png) [@hilt86](https://discuss.elastic.co/u/hilt86)\
**Post date:** [September 9, 2021, 9:57am UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/3 "2021-09-09T09:57:43Z")

</div>

Just the one that fleet gives you when you use the add agent dialogue

---

<div class="post-metadata">

**Author:** ![hilt86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilt86/32/20308_2.png) [@hilt86](https://discuss.elastic.co/u/hilt86)\
**Post date:** [September 9, 2021, 11:16am UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/4 "2021-09-09T11:16:34Z")

</div>

for example :

`sudo ./elastic-agent install -f --url=https://something.azure.elastic-cloud.com:443 --enrollment-token=secret`

---

<div class="post-metadata">

**Author:** ![hilt86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilt86/32/20308_2.png) [@hilt86](https://discuss.elastic.co/u/hilt86)\
**Post date:** [September 9, 2021, 11:17am UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/5 "2021-09-09T11:17:17Z")

</div>

Another team mate gets the following on her Mac :

```auto
panic: getwd: invalid argument

goroutine 1 [running]:
github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.retrieveExecutablePath(0x28, 0x0)
	/go/src/github.com/elastic/beats/x-pack/elastic-agent/pkg/agent/application/paths/common.go:157 +0x1aa
github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.initialTop(0x10aa72a67, 0x10b9c9245)
	/go/src/github.com/elastic/beats/x-pack/elastic-agent/pkg/agent/application/paths/common.go:146 +0x26
github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.init.0()
	/go/src/github.com/elastic/beats/x-pack/elastic-agent/pkg/agent/application/paths/common.go:36 +0x26

```

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [September 10, 2021, 11:44pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/6 "2021-09-10T23:44:19Z")

</div>

What OSX version ?

---

<div class="post-metadata">

**Author:** ![blaker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blaker/32/65621_2.png) [@blaker](https://discuss.elastic.co/u/blaker)\
**Post date:** [September 13, 2021, 3:43pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/7 "2021-09-13T15:43:17Z")

</div>

I second @zx8086 knowing the OSX version would be great? Also what is the execution directory you are running from? Seems that its having trouble getting its current work directory.

---

<div class="post-metadata">

**Author:** ![hilt86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilt86/32/20308_2.png) [@hilt86](https://discuss.elastic.co/u/hilt86)\
**Post date:** [September 23, 2021, 1:42am UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/8 "2021-09-23T01:42:13Z")

</div>

10.15.7 - I was running it from ~/Downloads/elastic-agent-x.y.z

---

<div class="post-metadata">

**Author:** ![ledge39](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@ledge39](https://discuss.elastic.co/u/ledge39)\
**Post date:** [October 13, 2021, 8:21pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/9 "2021-10-13T20:21:00Z")

</div>

I have the same issue

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 13, 2021, 8:23pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/10 "2021-10-13T20:23:12Z")

</div>

@ledge39

> [@ledge39](#):
>
> I have the same issue

What OS are you using ?  
What command are you running and do you have the error from the logs ?

---

<div class="post-metadata">

**Author:** ![ledge39](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@ledge39](https://discuss.elastic.co/u/ledge39)\
**Post date:** [October 13, 2021, 8:25pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/11 "2021-10-13T20:25:29Z")

</div>

sudo ./elastic-agent install -f --url=http://192.168.1.11:8220 --enrollment-token=secret

panic: getwd: invalid argument

goroutine 1 [running]:

[github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.retrieveExecutablePath](http://github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.retrieveExecutablePath)(0x28, 0x0)

/go/src/github.com/elastic/beats/x-pack/elastic-agent/pkg/agent/application/paths/common.go:187 +0x1aa

[github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.initialTop](http://github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.initialTop)(0x10286e327, 0x1038694a4)

/go/src/github.com/elastic/beats/x-pack/elastic-agent/pkg/agent/application/paths/common.go:176 +0x26

[github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.init.0()](http://github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths.init.0())

/go/src/github.com/elastic/beats/x-pack/elastic-agent/pkg/agent/application/paths/common.go:38 +0x26

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 13, 2021, 9:05pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/12 "2021-10-13T21:05:38Z")

</div>

Are you running it from the installation directory ?

Have you tried with HTTPS ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 10, 2021, 9:05pm UTC](https://discuss.elastic.co/t/cant-enroll-macos-agent/283601/13 "2021-11-10T21:05:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
