Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

OSX Uninstallation instructions are wrong #248

Closed
bklang opened this issue Nov 24, 2014 · 8 comments
Closed

OSX Uninstallation instructions are wrong #248

bklang opened this issue Nov 24, 2014 · 8 comments

Comments

@bklang
Copy link

bklang commented Nov 24, 2014

From https://docs.getchef.com/install_dk.html#mac-os-x:

ls -la /usr/bin | egrep '/opt/chefdk' | awk '{ print $9 }' | sudo xargs -I % rm -f /usr/bin/%

But $9 is the timestamp, not the filename. This should be print $10 to work correctly.

[bklang@Morningside:~/src/avoxi/avoxi-web] (master...origin/master|ruby-2.1.5)
[Mon Nov 24 14:26:11]$ ls -la /usr/bin | egrep '/opt/chefdk' | awk '{ print $9 }'
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02
14:02

[bklang@Morningside:~/src/avoxi/avoxi-web] (master...origin/master|ruby-2.1.5)
[Mon Nov 24 14:26:24]$ ls -la /usr/bin | egrep '/opt/chefdk' | awk '{ print $10 }'
berks
chef
chef-apply
chef-client
chef-shell
chef-solo
chef-zero
fauxhai
foodcritic
kitchen
knife
ohai
rubocop
shef
strain
strainer
@jrwesolo
Copy link

I cannot reproduce your issue. Here is my output:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.1
BuildVersion:   14B25
$ which ls
/bin/ls
$ ls -la /usr/bin | egrep '/opt/chefdk' | awk '{ print $9 }'
berks
chef
chef-apply
chef-client
chef-shell
chef-solo
chef-zero
fauxhai
foodcritic
kitchen
knife
ohai
rubocop
shef
strain
strainer

Can you show your output for the following commands?

sw_vers
which ls
ls -la /usr/bin | egrep '/opt/chefdk'

@bklang
Copy link
Author

bklang commented Nov 24, 2014

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.1
BuildVersion:   14B25

$ ls -la /usr/bin | egrep '/opt/chefdk'
lrwxr-xr-x     1 root   wheel  -                21 Nov 24 14:32 berks -> /opt/chefdk/bin/berks
lrwxr-xr-x     1 root   wheel  -                20 Nov 24 14:32 chef -> /opt/chefdk/bin/chef
lrwxr-xr-x     1 root   wheel  -                26 Nov 24 14:32 chef-apply -> /opt/chefdk/bin/chef-apply
lrwxr-xr-x     1 root   wheel  -                27 Nov 24 14:32 chef-client -> /opt/chefdk/bin/chef-client
lrwxr-xr-x     1 root   wheel  -                26 Nov 24 14:32 chef-shell -> /opt/chefdk/bin/chef-shell
lrwxr-xr-x     1 root   wheel  -                25 Nov 24 14:32 chef-solo -> /opt/chefdk/bin/chef-solo
lrwxr-xr-x     1 root   wheel  -                25 Nov 24 14:32 chef-zero -> /opt/chefdk/bin/chef-zero
lrwxr-xr-x     1 root   wheel  -                23 Nov 24 14:32 fauxhai -> /opt/chefdk/bin/fauxhai
lrwxr-xr-x     1 root   wheel  -                26 Nov 24 14:32 foodcritic -> /opt/chefdk/bin/foodcritic
lrwxr-xr-x     1 root   wheel  -                23 Nov 24 14:32 kitchen -> /opt/chefdk/bin/kitchen
lrwxr-xr-x     1 root   wheel  -                21 Nov 24 14:32 knife -> /opt/chefdk/bin/knife
lrwxr-xr-x     1 root   wheel  -                20 Nov 24 14:32 ohai -> /opt/chefdk/bin/ohai
lrwxr-xr-x     1 root   wheel  -                23 Nov 24 14:32 rubocop -> /opt/chefdk/bin/rubocop
lrwxr-xr-x     1 root   wheel  -                20 Nov 24 14:32 shef -> /opt/chefdk/bin/shef
lrwxr-xr-x     1 root   wheel  -                22 Nov 24 14:32 strain -> /opt/chefdk/bin/strain
lrwxr-xr-x     1 root   wheel  -                24 Nov 24 14:32 strainer -> /opt/chefdk/bin/strainer

@jrwesolo
Copy link

Odd. I'm not sure where that extra column is coming from. Is it possible you have an alias for ls?

$ alias ls
-bash: alias: ls: not found

We are on the same version of OSX so unless the ls binary is non-standard, this command should be changed to something with less assumptions. Changing the awk command to use $10 is not the answer as I think your experience is an edge case. We could use something like the following:

stat -f '%N %Y' /usr/bin/* | egrep '/opt/chefdk' | awk '{ print $1 }' | sudo xargs -I% rm -f %

@bklang
Copy link
Author

bklang commented Nov 24, 2014

I agree about not using $10, and probably avoiding parsing ls is a good idea. 👍 on using stat instead, or maybe even better if chef-dk came with an uninstall script.

@jrwesolo
Copy link

I went ahead and created a pull request on the documentation for ChefDK uninstallation: chef-boneyard/chef-web-docs-2016#409

More elegant solution:

find /usr/bin -lname '/opt/chefdk/*' -delete

@bklang
Copy link
Author

bklang commented Nov 24, 2014

Even better, thanks!

@jrwesolo
Copy link

Documentation updated: https://docs.getchef.com/install_dk.html#mac-os-x

If the change is satisfactory, this issue can be closed.

@lamont-granquist
Copy link
Contributor

FWIW, putting a '' in front of a command in tcsh/bash/zsh will avoid the use of aliases:

with alias ls=ls -F:

% ls -la /usr/bin | egrep '/opt/chefdk' | awk '{ print $9 }'
berks@
chef@
chef-apply@
chef-client@
chef-shell@
chef-solo@
chef-zero@
fauxhai@
foodcritic@
kitchen@
knife@
ohai@
rubocop@
shef@
strain@
strainer@
% \ls -la /usr/bin | egrep '/opt/chefdk' | awk '{ print $9 }'
berks
chef
chef-apply
chef-client
chef-shell
chef-solo
chef-zero
fauxhai
foodcritic
kitchen
knife
ohai
rubocop
shef
strain
strainer

+1 for find tho.

ksubrama pushed a commit that referenced this issue Jan 11, 2016
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants