# Cannot run Plex Media Scanner from the command line

**URL:** https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622
**Category:** General Discussions
**Created:** [January 28, 2017, 11:31pm UTC](https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622 "2017-01-28T23:31:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![javerre](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@javerre](https://forums.plex.tv/u/javerre)
#### Post date: [January 28, 2017, 11:31pm UTC](https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622/1 "2017-01-28T23:31:38Z")

</div>

Hi,

I’m trying to refresh my media index files using Plex Media Scanner from the command line. I’ve got a QNAP installation so I SSH onto the NAS and issue the following commands:  
`cd /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer Plex\ Media\ Scanner -h -sh: Plex Media Scanner: command not found`

Curiously, if I change up a directory I get a different error:  
`cd .. PlexMediaServer/Plex\ Media\ Scanner -h PlexMediaServer/Plex Media Scanner: error while loading shared libraries: libboost_atomic.so.1.59.0: cannot open shared object file: No such file or directory`

What am I doing wrong?

---

<div class="post-metadata">

### Author: ![comio](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/comio/32/81873_2.png) [@comio](https://forums.plex.tv/u/comio)
#### Post date: [January 29, 2017, 9:40am UTC](https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622/2 "2017-01-29T09:40:45Z")

</div>

Set the LD\_PRELOAD\_LIBRARY with your Plex Server directory.  
Google is your friend.

ciao

luigi

---

<div class="post-metadata">

### Author: ![gbooker02](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/gbooker02/32/9726_2.png) [@gbooker02](https://forums.plex.tv/u/gbooker02)
#### Post date: [January 30, 2017, 2:49pm UTC](https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622/3 "2017-01-30T14:49:53Z")

</div>

With the first one, likely you don’t have `.` in your path. If you want to execute a program in the current directory, it is typically advisable to run `./commandHere` rather than `commandHere`.

I’m not sure if it is different on qnap, but usually it is something along the lines of:

```auto
LD_LIBRARY_PATH=/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Plex\ Media\ Scanner

```

(I changed the paths above to match where yours seems to be installed. Hopefully it is correct.)

---

<div class="post-metadata">

### Author: ![javerre](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@javerre](https://forums.plex.tv/u/javerre)
#### Post date: [February 3, 2017, 11:13pm UTC](https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622/4 "2017-02-03T23:13:43Z")

</div>

Thanks everyone, sorry for being such a Linux noob!  
In case other people come here looking for the answer, what worked for me was:

```
$ export LD_LIBRARY_PATH=/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer
$ export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library
$ ./Plex\ Media\ Scanner -h
```

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)
#### Post date: [January 7, 2020, 10:39pm UTC](https://forums.plex.tv/t/cannot-run-plex-media-scanner-from-the-command-line/177622/5 "2020-01-07T22:39:41Z")

</div>


